Raspberry Pi Lesson 6.1 — Setup and First Blink

LessonsRaspberry Pi → Lesson 6.1
Raspberry Pi

Setup and First Blink

“A full Linux computer in your hand. Your first blink. You are now a maker.”

⏱ About 30 minutes 🛠 Raspberry Pi + Thonny ⭐ Lesson 1 of 3

What you will need

A Raspberry Pi and a few components.

Raspberry Pi
Any model — Pi 3, Pi 4, or Pi 5. Needs a microSD card (8GB+) with Raspberry Pi OS installed using the Raspberry Pi Imager tool.
Hardware needed
LED + Resistor
One LED and a 330 ohm resistor. Plus jumper wires and a breadboard.
Hardware needed
Thonny
A beginner-friendly Python editor. Pre-installed on Raspberry Pi OS. Open it from the Programming menu.
Pre-installed

What you will have

A Python script running on your Raspberry Pi that blinks an LED on and off — controlled by GPIO pins.


Your prompt

Copy this. Paste it into your AI. Hit Enter.

📋 Your Prompt — Copy Everything Below
Write a Python script for Raspberry Pi that blinks an LED connected to GPIO pin 17. Use the RPi.GPIO library. The LED should turn on for 1 second then off for 1 second and repeat. Include a try/except block so pressing Ctrl+C stops the program cleanly and resets the GPIO pins. Include comments explaining GPIO.setmode, GPIO.setup, GPIO.output, and GPIO.cleanup.
✅ Copied! Now paste it into your AI.

Wire it up

Connect your LED to the Pi.

1
Connect the long leg of the LED to GPIO 17 (physical pin 11)
Use a jumper wire via a breadboard.
2
Connect the short leg via a 330 ohm resistor to GND
Physical pin 6 or 9 are GND pins.
3
Boot your Pi and open Thonny
Programming menu → Thonny.

What to do after

Paste and run.

1
Paste the AI code into Thonny
File → New → paste → save as blink.py.
2
Press F5 to run
Watch your LED blink. Press Ctrl+C to stop it cleanly.

🛠️ Didn’t work?

Check these first:

1 Is the LED wired to physical pin 11 (GPIO 17)?
2 Is the resistor between the short leg and a GND pin?
3 Copy any red error text from Thonny and paste to your AI: “This didn’t work. Here’s the error: [paste]. Please fix it.”

Vibe Tweak

Make it blink faster.

Find the number 1 in the time.sleep lines. Change both to 0.2. Save and press F5.

Find this
time.sleep(1)
Change to this
time.sleep(0.2)

Extra Credit

Want to go further?

📋 Extra Credit Prompt
Update the Raspberry Pi blink script to blink an SOS pattern in Morse code. Three short blinks (0.2s on, 0.2s off), three long blinks (0.6s on, 0.2s off), three short blinks again. Then pause 2 seconds and repeat.
✅ Copied!

Reflection

Before you move on — think about this.

“You just ran Python code on a Linux computer the size of a credit card and it made a light blink in the real world. The same Python you used in Lesson 2 — just talking to different hardware.”

Up next
Raspberry Pi Lesson 6.2 — Manual GPIO Blink
Control two LEDs independently with full manual GPIO control.
Next Lesson →
Greg the Vibe Coder · gregthevibecoder.com 18 lessons · No account required