# https://docs.micropython.org/en/latest/esp32/quickref.html # # Heltec ESP32 LoRa V3 must be connected via USB # # run with # $ mpremote run esp32_demo.py # # hhoegl, 2024-07-14 from machine import Pin, ADC import time import esp32 for i in range(5): print(i) print("Hello Dillingen!") print() t = esp32.mcu_temperature() print(f"The MCU temperature is {t} °C") MAXBLINK = 5 print(f"See the LED blinking {MAXBLINK} times on and off ...") led = Pin(7, Pin.OUT) i = 0 while i < MAXBLINK: print(f" LED on {i}") led.on() time.sleep_ms(500) print(f" LED off {i}") led.off() time.sleep_ms(500) i = i + 1 # XXX does not work! adc = ADC(1) # pin GPIO1 is ADC1_CH0 val = adc.read() print("ADC value:", val) print("Finally press the button...") button = Pin(6, Pin.IN, Pin.PULL_UP) while button.value() == 1: time.sleep_ms(50) print("Button pressed! Thank you.")