Lighting LED with Raspberry Pi - shazforiot/IoT GitHub Wiki
What do you need: Raspberry Pi Bread Board LED Resistor -220 ohm Jumper wires - Male to Female Using a breadboard is the best way to do prototyping the electronic circuits rather soldering the components together on a PCB.We use breadboard to test circuit design & it is easy to make the changes , as we just need to re-plug the wires.
The details for GPIO pins I have described in my previous post, refer the post my IoT Devices .
Now in actual circuit with Raspberry pi ( I have used Raspberry Pi zero W), I have used the GPIO pin 7 for the circuit. Connect the GPIO PIN 7 to the anode of LED & the GPIO PIN 6 which the GND(ground) connect to the other end of resistor. Refer the below screenshot. Once we have the circuit setup & the Raspberry Pi is powered on, it is now time to write the python code.
To write the python code you can use python IDLE or you can even use text editor & save the file with extension .py. I prefer python IDLE as it comes with Raspbian libraries & it is easy to debug, also the errors in syntax can be easily identified.
Lets create a file LED.py & start our python program. I will start with a Simple Programto turn on the LED when we run the script.