File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ """Test script to read raw radar output."""
3+
4+ import serial
5+ import serial .tools .list_ports
6+
7+ # List all ports
8+ print ("Available serial ports:" )
9+ for p in serial .tools .list_ports .comports ():
10+ print (f" { p .device } : vid={ p .vid } desc={ p .description } " )
11+
12+ # Find radar port (try common names)
13+ port = None
14+ for p in serial .tools .list_ports .comports ():
15+ if 'ACM' in p .device or 'usbmodem' in p .device :
16+ port = p .device
17+ break
18+
19+ if not port :
20+ print ("\n No radar port found. Specify manually:" )
21+ print (" python scripts/test_radar_raw.py /dev/ttyACM0" )
22+ exit (1 )
23+
24+ print (f"\n Connecting to { port } ..." )
25+ s = serial .Serial (port , 57600 , timeout = 2 )
26+
27+ print ("Reading 20 lines (wave your hand in front of radar):\n " )
28+ for i in range (20 ):
29+ data = s .readline ()
30+ print (f"{ i :2d} : { data !r} " )
31+
32+ s .close ()
33+ print ("\n Done." )
You can’t perform that action at this time.
0 commit comments