Skip to content

Instantly share code, notes, and snippets.

@kurosuke
Created November 24, 2012 15:17
Show Gist options
  • Save kurosuke/4140076 to your computer and use it in GitHub Desktop.
Save kurosuke/4140076 to your computer and use it in GitHub Desktop.
pyhon GPIO control on Raspberry Pi
import time
import RPi.GPIO as GPIO
# GPIO setup
GPIO.setmode(GPIO.BCM)
# GPIO4(PIN7) setup for output
GPIO.setup(4, GPIO.OUT)
# 1sec on and 0.5sec off
for i in range(10):
print('NO ' + `i`)
GPIO.output(4, True)
time.sleep(1.0)
GPIO.output(4, False)
time.sleep(0.5)
# GPIO cleanup
GPIO.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment