Posts

Showing posts with the label Raspberry Pi Led Projects

Basic Raspberry PI Projects

Image
How to blink an LED using Raspberry Pi and the Python Software? 1. Gather all electronics materials and make the led-resistor circuit first.     Connection: Pin 18 > Led > Resistor > Ground. 2. Open the Raspbian icon menu, select programming and choose Python Idle 3. Once python is open, click File > New File 4. Copy and paste the code (to turn on/off led): import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(18,GPIO.OUT) #print "Led ON" GPIO.output(18,GPIO.HIGH) time.sleep(10) #print "Led OFF" GPIO.output(18,GPIO.LOW) 5. OR, copy and paste this code (to blink the led): import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(18,GPIO.OUT) while True:  GPIO.output(18, True)      # Turn on pin 18  time.sleep(1)                    # Delay  GPIO.output(18, False) ...