top of page
First Steps
What we will learn: How to turn an LED off and on with the Raspberry Pi General Purpose Inputs and Output Pins with Scratch
One 220 ohm resistor
or
Materials:
Two male to male jumpers
One LED
Follow the instructions below and try playing with the code to see what changes you can make
Click here first
then click here
2.Click on More Blocks and Add an Extension
click here
then here
3.Click on the Raspi picture to add the GPIO
click here
then click OK down here
4.Cool! These are the General Purpose Input Output blocks we will need to connect to Scratch to the Raspberry Pi
these are your GPIO blocks
WARNING!!!!!!
5.Plug your male jumper into GPIO 5 and into any number below the GND on your T-Cobbler on your bread board
Do not start randomly plugging in wires or LEDs into the
breadboard. You can damage or destroy the Pi! Only use the numbered GPIO's and follow each tutorial step closley
this is GPIO 5 plug your jumper right across from it
then plug the other end into your breadboard any number will be ok!
6.Grab your LED, the LONG LEG (anode+) is the one you want to plug across from the jumper
LONG LEG (anode+)
short leg (cathode-)
6.Put the LONG LEG into the hole ACROSS from the jumper and the short leg next to it
LONG LEG (anode+)
short leg (cathode-)
7.Grab a 220 Ohm resistor. Check out this site and place in the colour code in the menu to see what kind of resistor you have
Red
Red
Brown
Gold
or
Red
Red
Black
Black
Brown
9.Place the resistor next to the cathode (short leg) and the other end in the ground
put your resistor in here in ground
the resistor reduces the amount of current
you current will run up here to the - symbol
10.OK now lets turn that LED on! Pull out a "when clicked block" a "forever block" and a "set gpio to output high" block. Place "5" in the gpio block. Then click the green flag
from More Blocks
from Events
11.To get the light blinking follow the code below! Set the other gpio block to "output low"
set to "low"
set to "high"
12.a)GPIO 5 is set to HIGH which sends 3.3 volts to the pin
b)GPIO 5 is set to LOW which sends 0 volts to the pin
c)You are making it wait 1 second in between
d)the forever loop makes to loop forever!
Taking it Further
You will need to wire up 3 blinking at once to move to the next challenge, or maybe you are feeling adventurous and can do more?
there is a mistake here, what do you think it is?
NEXT
BACK
bottom of page