This project will teach you how to use Scratch and a Raspberry Pi to control an LED! It’s a fun way to combine coding and hardware. 🚀


🔹 What You’ll Need

✅ Raspberry Pi (any model with GPIO pins)
✅ A breadboard
✅ 1 LED (any color)
✅ 1 Resistor (330Ω)
✅ Jumper wires


🔹 Step 1: Connect the LED to Raspberry Pi

1️⃣ Insert the LED into the breadboard.
2️⃣ Connect the long leg (positive, anode) to GPIO Pin 17 on the Raspberry Pi.
3️⃣ Connect the short leg (negative, cathode) to the resistor and then to GND (Ground) Pin.

📌 GPIO Pin 17 = Physical Pin 11
📌 GND = Physical Pin 6


🔹 Step 2: Open Scratch on Raspberry Pi

1️⃣ Click on ApplicationsProgrammingScratch 3.
2️⃣ Enable GPIO in Scratch:

  • Click Extensions (bottom left)
  • Select Pi GPIO

🔹 Step 3: Write Your Scratch Program

👉 To Turn the LED ON:

  • Drag “When Green Flag Clicked” from Events.
  • Add “Set GPIO 17 to High” from the Pi GPIO section.
  • Add a “Wait 1 Second” block from Control.

👉 To Turn the LED OFF:

  • Add “Set GPIO 17 to Low” after the wait block.
  • Add another “Wait 1 Second” block.
  • Wrap everything inside a Forever Loop so it keeps blinking.

🔹 Step 4: Run Your Program

✅ Click the Green Flag ▶️.
✅ The LED will start blinking! 🚦


🔹 Step 5: Experiment! 🚀

💡 Try changing the GPIO pin number to control multiple LEDs.
💡 Use a button to turn the LED on and off.
💡 Make a traffic light simulation with red, yellow, and green LEDs!


🎯 Congratulations! You’ve made your first Raspberry Pi + Scratch project! Want more ideas? Let me know! 😊💡

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *

x  Powerful Protection for WordPress, from Shield Security
This Site Is Protected By
Shield Security