Within this tutorial we are going to turn an LED on using EduBlocks and a Raspberry Pi.
Equipment You Will Need
- 1 x LED
- 2 x male to female jumper wires
- 1 x breadboard
- 1 x 330Ω resistor
- Raspberry Pi
- SD Card with Raspbian installed
- HDMI cable
- Compatible Screen
- Power Supply
Lets build the circuit. Make sure you have your LED the right way round. The positive leg is the longer leg on the LED, this is represented by the bent leg in the diagram below:
There are two things we need to do to start EduBlocks
- Go to menu -> programming and click on EduBlocks Connect. (if you have EduBlocks set to start on Startup go to step 2)
- open a web browser and type app.edublocks.org and click on Raspberry Pi.
NOTE: If you have a raspberry pi set up on your home network with EduBlocks installed and running you can access it from another computer using it's IP address
- Click on gpiozero
- Click on General, click and drag a **from gpiozero import *** to the coding area and drop it.
- Click on Outputs
- Click on LED click and drag an led =LED() block to the coding area and attach it under **from gpiozero import ***
- Click in the blank space of led =LED() and type 18.
- Click on LED click and drag an led.on() block to the coding area and attach it under led =LED(18)
Your code should now look like this:
Running the code
To run your code click on Run on the toolbar above the coding area.
You should now see the LED attached to your Raspberry Pi turn on.
Well done you have made an LED turn on by using your Raspberry Pi and code!