""" XIAO ESP32-C6: ESPNOW -> UART passthrough to Pico. Receives messages via ESPNOW, forwards them unchanged to UART (GPIO17). UART at 921600 baud. LED on GPIO15 blinks on activity. """ import network import espnow import machine import time # UART: TX on GPIO17 -> Pico RX, max baud for throughput UART_BAUD = 921600 uart = machine.UART(1, baudrate=UART_BAUD, tx=17) led = machine.Pin(15, machine.Pin.OUT) # WLAN must be active for ESPNOW (no need to connect) sta = network.WLAN(network.WLAN.IF_STA) sta.active(True) sta.disconnect() e = espnow.ESPNow() e.active(True) # No peers needed to receive; add_peer() only for send() # Recv timeout 0 = non-blocking print("ESP32: ESPNOW -> UART passthrough, %d baud" % UART_BAUD) while True: mac, msg = e.irecv(0) if msg: uart.write(msg) led.value(1) else: led.value(0) time.sleep_ms(1)