Modifications

Sauter à la navigation Sauter à la recherche
89 octets ajoutés ,  26 octobre 2024 à 23:06
Ligne 35 : Ligne 35 :  
from machine import Pin
 
from machine import Pin
 
import time
 
import time
−
p = Pin( 2, Pin.OUT )
+
p_in = Pin( 10, Pin.INPUT, Pin.PULL_UP )
   −
# Allumer la LED
+
while True:
−
p.value( True )
+
    # lecture de l'état
−
time.sleep(1)
+
    v = p_in.value()
 +
   
 +
    if v==0:
 +
        print( 'PRESS' )
 +
    else:
 +
        print( '---' )
   −
# Eteindre la LED
+
    time.sleep(1)
−
p.value( False )
   
</syntaxhighlight>
 
</syntaxhighlight>
  
32 920

modifications

Menu de navigation