Created
November 24, 2012 15:17
-
-
Save kurosuke/4140076 to your computer and use it in GitHub Desktop.
pyhon GPIO control on Raspberry Pi
This file contains 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
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