Files
led-hoop/pico/test/test_serial_send.py
Jimmy 52a5f0f8c4 Add Pico presets engine, patterns, and tests.
Wire the Pico to UART-driven preset selection, add pattern modules and presets data, remove old p2p/settings code, and update tests and LED driver.

Made-with: Cursor
2026-03-03 19:28:11 +13:00

24 lines
754 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""
Serial send test single file. Run on ESP32 (TX side).
Wire: ESP32 TX (GPIO17) → Pico RX (GPIO1); GND ↔ GND. Run receive test on Pico.
mpremote run pico/test/test_serial_send.py
"""
import time
import sys
from machine import UART, Pin
if "esp32" in sys.platform:
UART_ID, TX_PIN, BAUD = 1, 17, 115200
else:
UART_ID, TX_PIN, BAUD = 0, 0, 115200
print("UART send: %s UART%d TX=%s %d baud" % (sys.platform, UART_ID, TX_PIN, BAUD))
uart = UART(UART_ID, baudrate=BAUD, tx=Pin(TX_PIN, Pin.OUT))
for line in [b"serial send test 1", b"serial send test 2", b"{\"v\":\"1\",\"b\":128}"]:
uart.write(line + b"\n")
print("sent:", line.decode("utf-8"))
time.sleep_ms(50)
uart.deinit()
print("Send test done.")