Skip to content

Instantly share code, notes, and snippets.

@0xPr0xy
Last active December 16, 2015 22:09
Show Gist options
  • Select an option

  • Save 0xPr0xy/5504755 to your computer and use it in GitHub Desktop.

Select an option

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
#!/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