Migrate MCP and utilities to CircuitPython, including color GIF and volume fixes
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import serial
|
||||
import time
|
||||
import sys
|
||||
|
||||
def main():
|
||||
port = "/dev/cu.usbmodem411CF91D65091"
|
||||
print(f"Connecting to {port} at 115200...")
|
||||
try:
|
||||
ser = serial.Serial(port, 115200, timeout=1.0)
|
||||
except Exception as e:
|
||||
print(f"Error opening serial port: {e}")
|
||||
return
|
||||
|
||||
print("Reading serial output for 3 seconds...")
|
||||
start_time = time.time()
|
||||
try:
|
||||
while time.time() - start_time < 3.0:
|
||||
if ser.in_waiting > 0:
|
||||
data = ser.read(ser.in_waiting)
|
||||
sys.stdout.write(data.decode("utf-8", "ignore"))
|
||||
sys.stdout.flush()
|
||||
time.sleep(0.1)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
finally:
|
||||
ser.close()
|
||||
print("\nSerial connection closed.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user