Différences entre versions de « MicroPython-esp32-evb »
Sauter à la navigation
Sauter à la recherche
Ligne 20 : | Ligne 20 : | ||
rel2.on() | rel2.on() | ||
rel2.off() | rel2.off() | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | == Utiliser le bouton utilisateur == | ||
+ | |||
+ | Le bouton utilisateur est raccordé sur le GPIO 34. | ||
+ | |||
+ | [[Fichier:MicroPython-esp32-evb-button.png]] | ||
+ | |||
+ | |||
+ | <syntaxhighlight lang="python"> | ||
+ | from machine import Pin | ||
+ | from time import sleep_ms | ||
+ | |||
+ | btn = Pin( 34, Pin.IN ) | ||
+ | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Version du 24 mai 2021 à 23:17
ESP32-EVB (Evaluation Board)
presentation
Commander les Relais
Les relais sont branchés sur les GPIO 32 et GPIO 33.
from machine import Pin
rel1 = Pin( 32, Pin.OUT )
rel2 = Pin( 33, Pin.OUT )
rel1.on()
rel1.off()
rel2.on()
rel2.off()
Utiliser le bouton utilisateur
Le bouton utilisateur est raccordé sur le GPIO 34.
from machine import Pin
from time import sleep_ms
btn = Pin( 34, Pin.IN )