Files
codes-pedagogie/test-led-telecommande.py
T
2026-07-14 19:11:55 +02:00

41 lines
872 B
Python

# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
import os, machine, time, gc
#os.dupterm(None, 1) # disable REPL on UART(0)
BJ = machine.Pin(0, machine.Pin.IN, machine.Pin.PULL_UP)
BV = machine.Pin(5, machine.Pin.IN, machine.Pin.PULL_UP)
BB = machine.Pin(4, machine.Pin.IN, machine.Pin.PULL_UP)
BR = machine.Pin(2, machine.Pin.IN, machine.Pin.PULL_UP)
LR = machine.Pin(14, machine.Pin.OUT)
LV = machine.Pin(12, machine.Pin.OUT)
LB = machine.Pin(13, machine.Pin.OUT)
def raz():
LR.value(0)
LV.value(0)
LB.value(0)
while True:
if BR.value() == 0:
raz()
LR.value(1)
if BB.value() == 0:
raz()
LB.value(1)
if BV.value() == 0:
raz()
LV.value(1)
if BJ.value() == 0:
raz()
LR.value(1)
LV.value(1)