import time
import machine
from machine import Pin
time.sleep(0.1) # Wait for USB to become ready
tasteri = [ Pin(i, Pin.IN) for i in range(4) ]
leds = [ Pin(i, Pin.OUT) for i in range(4, 12) ]
count = 0
while (True):
if (tasteri[0].value()):
count = (count + 1) % 256
elif (tasteri[1].value()):
count = (count - 1) % 256
elif (tasteri[2].value()):
count = 255
elif (tasteri[3].value()):
count = 0
binar = "{0:08b}".format(count)
for i in range(8):
leds[i].value(int(binar[i]))
time.sleep(0.2)