Turning An LED On

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 ohm resistor
  • Raspberry Pi
  • keyboard
  • Mouse
  • SD Card with Raspbian installed
  • HDMI cable
  • Compatible Screen
  • Power Supply

The Circuit

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:

LED Circuit

Code

The fist thing we need to do is open EduBlocks. do this by double clicking on the EduBlocks desktop icon. (if you don’t have EduBlocks installed take a look at the Getting started guide

  • Click on the GPIOZero menu and click on the General menu and locate the import gpiozero * and drag it to the coding area.

  • Next Click on the Outputs menu menu. Then click on the LED menu From here locate the led = LED pin and drag it to the coding area and attach it under the import gpiozero *. where it says pin change that to say 18.

  • Next locate the led.on() and attach it under the led = LED pin

Your code should now look like this:
LED on

Running Your Code

To run your code click on Run in the top far right corner.

You should now see your LED turn on.

Keep having FUN while LEARNING!