So this is my first project with Raspberry Pi! I’ve made a simple blinking LED project.
Check out other Raspberry Pi Projects here: (LINK)
Demo:
Things Required:
- Raspberry Pi (I’ve used Raspberry Pi 3)
- Keyboard
- Mouse
- HDMI Screen
- LED
- 1 k ohm resistor
Reference Material:
Code:
Note that the following code is in python!
View on/Download from Github: (LINK)
#!/usr/bin/python3
import RPi.GPIO as GPIO
import time
ledpin=22
def setup():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(ledpin, GPIO.OUT)
GPIO.output(ledpin, GPIO.LOW)
def loop():
while True:
print ('LED on')
GPIO.output(ledpin, GPIO.HIGH)
time.sleep(1.0)
print ('LED off')
GPIO.output(ledpin, GPIO.LOW)
time.sleep(1.0)
def endprogram():
GPIO.output(ledpin, GPIO.LOW)
GPIO.cleanup()
if __name__ =='__main__':
setup()
try:
loop()
except KeyboardInterrupt:
endprogram()
Stay Tuned for upcoming posts on Raspberry Pi Projects! Want to be the first to know when a new and amazing post comes up?? Then feel free to subscribe!
Happy Learning!!
