Back to Browse

Raspberry Pi Workshop Kit Tutorials – 2 LED On & Off

4.4K views
Jun 15, 2017
9:10

Welcome to the Raspberry Pi Workshop Tutorials, brought to you by ModMyPi, BuyaPi.ca, and PiShop.us. In this series, we’ll demonstrate nine projects that can be made using the YouTube Workshop Kit for Raspberry Pi. These projects are a great way to familiarize yourself with the Pi’s input and output functions, as well as creating programs in Python that we’ll use to control the Pi’s hardware. Tutorial 2 - LED On & Off Circuit Diagram: http://www.modmypi.com/download/led_bb.png Tutorial 2 Download: http://www.modmypi.com/download/youtube_workshop_2_led.pdf View Tutorial Online: https://www.modmypi.com/blog/youtube-workshop-kit/gpio-and-python-29-leds *** Code Used In This Tutorial *** #!/usr/bin/python import RPi.GPIO as GPIO # import a library GPIO.setmode(GPIO.BCM) # set the pin numbering system to BCM GPIO.setup(17,GPIO.OUT) # set GPIO17 as an OUTPUT GPIO.setup(27,GPIO.OUT) # set GPIO27 as am OUTPUT print "Lights on" # print to the screen so we know what’s going on GPIO.output(17,GPIO.HIGH) # set GPIO17 high, 3v3 will now be active on that pin GPIO.output(27,GPIO.HIGH) # set GPIO27 high, 3v3 will now be active on that pin ****************** #!/usr/bin/python import RPi.GPIO as GPIO # import a library GPIO.setmode(GPIO.BCM) # set the pin numbering system to BCM GPIO.setup(17,GPIO.OUT) # set GPIO17 as an OUTPUT GPIO.setup(27,GPIO.OUT) # set GPIO27 as am OUTPUT print "Lights off" # print to the screen so we know what’s going on GPIO.output(17,GPIO.LOW) # set GPIO17 low, 3v3 will now be de-active on that pin GPIO.output(27,GPIO.LOW) # set GPIO27 low, 3v3 will now be de-active on that pin

Download

0 formats

No download links available.

Raspberry Pi Workshop Kit Tutorials – 2 LED On & Off | NatokHD