25 lines
526 B
Python
25 lines
526 B
Python
from machine import Pin
|
|
import time
|
|
|
|
knopf1 = Pin(13, Pin.IN, Pin.PULL_DOWN)
|
|
knopf2 = Pin(8, Pin.IN, Pin.PULL_DOWN)
|
|
knopf3 = Pin(3, Pin.IN, Pin.PULL_DOWN)
|
|
rot = Pin(20, Pin.OUT)
|
|
gelb = Pin(19, Pin.OUT)
|
|
gruen = Pin(18, Pin.OUT)
|
|
rot.value(0)
|
|
gelb.value(0)
|
|
gruen.value(0)
|
|
|
|
while True:
|
|
time.sleep(0.2)
|
|
|
|
if knopf1.value() == 1:
|
|
print("Knopf 1 gedrückt")
|
|
rot.toggle()
|
|
if knopf2.value() == 1:
|
|
print("Knpf 2 gedrückt")
|
|
gelb.toggle()
|
|
if knopf3.value() == 1:
|
|
gruen.toggle()
|