Created
January 9, 2016 12:37
-
-
Save aansubarkah/074faf3dfdc461c98de5 to your computer and use it in GitHub Desktop.
short script to turn on and off LED, with Raspberry Pi 2
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 RPi.GPIO as GPIO # library standar pada Rasbian OS | |
import time | |
red = 7 # pin 7 disambungkan dengan LED berwarna merah | |
delay = 3 # delay 3 detik | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setwarnings(False) | |
GPIO.setup(red, GPIO.OUT) | |
GPIO.output(red, GPIO.HIGH) # beri sinyal HIGH (1) pada pin 7, akan menyalakan LED | |
time.sleep(delay) # tunggu 3 detik sebelum melakukan perintah selanjutnya | |
GPIO.output(red, GPIO.LOW) # beri sinyal LOW (0) pada pin 7, mematikan LED | |
GPIO.cleanup() # program selesai |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment