Guest User

Untitled

a guest
Oct 20th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import RPi.GPIO as GPIO # เรียกใช้ไลบารี่ RPi.GPIO
  2. import time # เรียกใช้ไลบารี่ Time
  3.  
  4. PIN_NUM = 15 # กำหนดขาที่ต่ออยู่กับหลอด LED
  5.  
  6. GPIO.setmode(GPIO.RAW) # กำหนดเลือกใช้หมายเลขขาแบบ Linux gpio
  7. GPIO.setup(PIN_NUM,GPIO.OUT) # กำหนดให้ขาที่ต่อกับหลอด LED เป็นเอาต์พุต
  8.  
  9. while True:
  10. GPIO.output(PIN_NUM, True) # ให้หลอด LED ติด
  11. time.sleep(1) # หยุดโปรแกรมเป็นเวลา 1 วินาที
  12. GPIO.output(PIN_NUM, False) # ให้หลอด LED ดับ
  13. time.sleep(1) # หยุดโปรแกรมเป็นเวลา 1 วินาที
Add Comment
Please, Sign In to add comment