rasp

from gpiozero import LED
from time import sleep, time

led = LED(17)

def blink(freq, duration):
«  » »Clignote à freq Hz pendant duration secondes » » »
period = 1.0 / freq # durée d’un cycle (ON+OFF)
half = period / 2
end_time = time() + duration

while time() < end_time:
    led.on()
    sleep(half)
    led.off()
    sleep(half)

try:
# ton enchaînement
blink(10, 5) # 10 Hz pendant 5 s
blink(20, 5) # 20 Hz pendant 5 s
blink(40, 3) # 40 Hz pendant 3 s
finally:
led.off() # sécurité si arrêt brutal

Ballade Sonore dans la Mega-Cité
Révolution Silencieuse
M_Doseur
Spectacle immersif
Poésie
Slam
To top