25 lines
488 B
Python
25 lines
488 B
Python
|
from machine import Pin
|
||
|
import time
|
||
|
gruen = Pin(18, Pin.OUT)
|
||
|
gelb = Pin(19, Pin.OUT)
|
||
|
rot = Pin(20, Pin.OUT)
|
||
|
|
||
|
# Anzahl der Iterationen für die Schleife
|
||
|
anzahl = 20
|
||
|
|
||
|
# Schleife mit Verzögerung von 5 Sekunden
|
||
|
for i in range(anzahl):
|
||
|
print(f"Schleifeniteration {i + 1}")
|
||
|
rot.value(1)
|
||
|
time.sleep(3)
|
||
|
rot.value(0)
|
||
|
gelb.value(1)
|
||
|
time.sleep(3)
|
||
|
gelb.value(0)
|
||
|
gruen.value(1)
|
||
|
time.sleep(5)
|
||
|
rot.value(0)
|
||
|
gelb.value(0)
|
||
|
gruen.value(0)
|
||
|
time.sleep(5)
|