A simple exercise of digital input/output on ESP32/MicroPython, digitalIn.py.
from machine import Pin
from time import sleep
LED2 = Pin(2, Pin.OUT)
IN32 = Pin(32, Pin.IN, Pin.PULL_UP);
while True:
v = IN32.value()
LED2.value(v)
print(v)
sleep(0.1)
- Note that GPIO6-11 are usually used for SPI flash.
- GPIO34-39 can only be set as input mode and do not have software pullup or pulldown functions.
reference: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/gpio.html
No comments:
Post a Comment