Modifications

Sauter à la navigation Sauter à la recherche
491 octets supprimés ,  27 octobre 2024 à 16:44
Ligne 146 : Ligne 146 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
=== Méthodes on() et off() ===
     −
La méthode {{fname|on()}} permet de placer une broche au niveau HAUT (3.3V) tandis que la méthode {{fname|off()}} place la broche au niveau BAS (0V).
  −
  −
Utiliser les méthodes {{fname|on()}} et {{fname|off()}} permettent d'améliorer la lisibilité du script.
  −
  −
<syntaxhighlight lang="python" line highlight="6,10">
  −
from machine import Pin
  −
import time
  −
p = Pin( 2, Pin.OUT )
  −
  −
# Allumer la LED
  −
p.on()
  −
time.sleep(1)
  −
  −
# Eteindre la LED
  −
p.off()
  −
</syntaxhighlight>
      
{{P2E-TRAILER}}
 
{{P2E-TRAILER}}
32 920

modifications

Menu de navigation