Unyil Raspi #17 Menyalakan 8 Lampu Secara Zig Zag

Anggy ingin sharing tentang cara menyalakan 8 led bisa nyala secara zigzag

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 GPIO
 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(13,GPIO.OUT)
 GPIO.setup(6,GPIO.OUT)

while True:

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

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

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

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

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

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

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

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

GPIO.output(6, GPIO.LOW)

 

3. lalu jalankan sudo python light10.py

4. dan 8 Lampu Nyala Secara Zig Zag ^^

 

back to Unyil Raspi #16
next to Unyil Raspi #18

Views All Time
Views All Time
41
Views Today
Views Today
1
42 Total Views 1 Views Today

Leave a Reply

You must be logged in to post a comment.