Unyil Raspi #16 Menyalakan 8 Lampu Secara Naik Turun

Anggy ingin sharing tentang cara menyalakan 8 led bisa nyala secara naik turun

siapkan :
1 (satu) Menggunakan Raspberry Pi 3

2. 8 (Delapan) LED

3. 1 (satu)  breadboard

4. kabel Jumper secukupnya

5. Adaptor 2A

yuk cek this out :

Laptop dan Raspberry Pi harus terkoneksi pada Jaringan yang Sama

Rangkai Led pada Pin GPIO Raspberry Pi dan buka terminal raspi
dan kodingannya:

import RPi.GPIO as GPI
 import time
 GPIO.setmode (GPIO.BCM)
 GPIO.setup(25,GPIO.OUT)
 GPIO.setup(14,GPIO.OUT)
 GPIO.setup(21,GPIO.OUT)
 GPIO.setup(12,GPIO.OUT)
 GPIO.setup(26,GPIO.OUT)
 GPIO.setup(19,GPIO.OUT)
 GPIO.setup(13GPIO.OUT)
 GPIO.setup(6,GPIO.OUT)
 while True:

GPIO.output(25, GPIO.HIGH)
 GPIO.output(14, GPIO.HIGH)
 GPIO.output(21, GPIO.HIGH)
 GPIO.output(12, GPIO.HIGH)
 GPIO.output(26, GPIO.HIGH)
 GPIO.output(19, GPIO.HIGH)
 GPIO.output(13, GPIO.HIGH)
 GPIO.output(6, GPIO.HIGH)

time.sleep(1)

GPIO.output(25, GPIO.LOW)
 time.sleep(1)

GPIO.output(14, GPIO.LOW)
 time.sleep(1)

GPIO.output(21, GPIO.LOW)
 time.sleep(1)

GPIO.output(12, GPIO.LOW)
 time.sleep(1)

GPIO.output(26, GPIO.LOW)
 time.sleep(1)

GPIO.output(19, GPIO.LOW)
 time.sleep(1)

GPIO.output(13, GPIO.LOW)
 time.sleep(1)

GPIO.output(6, GPIO.LOW)
 time.sleep(1)

3. lalu jalankan sudo python light9.py

4. dan 8 Lampu Nyala Secara Naik Turun ^^

 

back to Unyil Raspi #15
next to Unyil Raspi #17

Views All Time
Views All Time
42
Views Today
Views Today
1
45 Total Views 1 Views Today

Leave a Reply

You must be logged in to post a comment.