Last active
December 16, 2015 22:09
-
-
Save 0xPr0xy/5504755 to your computer and use it in GitHub Desktop.
power a led connected to pin 26 and ground with a button connected to pin 3 and ground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import RPi.GPIO as GPIO | |
| #print GPIO.RPI_REVISION 2 | |
| #print GPIO.VERSION 0.4.1a | |
| input_channel = 16 | |
| output_channel = 18 | |
| GPIO.setmode(GPIO.BOARD) | |
| GPIO.setup(input_channel, GPIO.IN, pull_up_down=GPIO.PUD_UP) | |
| GPIO.setup(output_channel,GPIO.OUT) | |
| try: | |
| while True: | |
| GPIO.output(output_channel, GPIO.input(input_channel)) | |
| except KeyboardInterrupt: | |
| GPIO.cleanup() | |
| ~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment