from machine import Pin
tombol = Pin(2, Pin.IN)
led1 = Pin(15, Pin.OUT)
led2 = Pin(4, Pin.OUT)
led3 = Pin(5, Pin.OUT)
from time import sleep
hitung = 0;
flag = True;
while True:
status_tombol = tombol.value()
print(status_tombol)
sleep(0.1)
if(status_tombol == 1 and flag == True):
hitung = hitung + 1
print(hitung)
flag = False
if(hitung == 1):
led1.on()
if(hitung == 2):
led1.off()
hitung = 0
if(hitung == 0):
led2.on()
if(hitung == 1):
led2.off()
led2.value()
if(hitung == 0):
led3.on()
if(hitung == 1):
led3.off()
if(hitung == 1):
led3.off()
led3.value()
if(status_tombol == 0):
flag = True