19 lines
257 B
Python
19 lines
257 B
Python
|
|
||
|
from gpiozero import LED, Button
|
||
|
from time import sleep
|
||
|
import random
|
||
|
|
||
|
count = 0
|
||
|
|
||
|
leds = [LED(19), LED(26), LED(13)]
|
||
|
button = Button(5)
|
||
|
|
||
|
def b():
|
||
|
print("pressed")
|
||
|
|
||
|
button.when_pressed = b
|
||
|
|
||
|
while True:
|
||
|
leds[random.randint(0,2)].toggle()
|
||
|
sleep(0.2)
|