The Raspberry Pi is a versatile mini-computer that supports multiple programming languages. Here’s how to start coding on it, from setup to running your first program.
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
1. Set Up Your Raspberry Pi
What You Need
- Raspberry Pi (any model, but Pi 4/5 recommended).
- MicroSD card (16GB+) with Raspberry Pi OS (previously called Raspbian).
- Keyboard, mouse, and monitor (or SSH for headless setup).
Install Raspberry Pi OS
- Download Raspberry Pi Imager from raspberrypi.com.
- Flash the OS to your MicroSD card.
- Insert the card into the Pi, power it on, and complete setup.
2. Choose a Programming Language
The Pi supports almost any language, but the easiest for beginners are:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
3. Write & Run Your First Program (Python Example)
A. Using the Thonny IDE (Pre-installed)
- Open Thonny from the Programming menu.
- Type:
- Click Run (or press F5).
B. Using Terminal (Command Line)
- Open Terminal.
- Create a file:
- Type the Python code, then save (Ctrl+O, Enter, Ctrl+X).
- Run it:
4. Coding for GPIO (Hardware Control)
Want to blink an LED? Here’s how:
Circuit Setup
- Connect LED+ to GPIO17 (Pin 11).
- Connect LED- to GND (Pin 9) with a 220Ω resistor.
Python Code (Using RPi.GPIO Library)
Run with:
5. Other Ways to Code on Raspberry Pi
A. Remote Development (VS Code + SSH)
- Enable SSH on Pi (sudo raspi-config → Interfacing Options → SSH).
- Install VS Code on your PC + "Remote SSH" extension.
- Connect to your Pi and edit files directly.
B. Web-Based IDEs
Jupyter Notebook (for Python):
Access at http://<Pi-IP>:8888.
6. Next Steps
- Explore sensors (DHT11, Ultrasonic, PIR).
- Build a web server (Flask, Node.js).
- Try robotics (using GPIO + motors).