-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_agx.py
More file actions
29 lines (24 loc) · 858 Bytes
/
test_agx.py
File metadata and controls
29 lines (24 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
import serial
import time
port = '/dev/tty.usbmodem01234567891'
ser = serial.Serial(port, 115200, timeout=1)
time.sleep(2)
ser.reset_input_buffer()
print('=== Test: device --agx --power off ===')
ser.write(b'device --agx --power off\r\n')
time.sleep(3)
while ser.in_waiting:
print(ser.read(ser.in_waiting).decode('utf-8', errors='replace'), end='', flush=True)
print('\n\n=== Test: device --agx --power on ===')
ser.write(b'device --agx --power on\r\n')
time.sleep(3)
while ser.in_waiting:
print(ser.read(ser.in_waiting).decode('utf-8', errors='replace'), end='', flush=True)
print('\n\n=== Test: device --agx --status ===')
ser.write(b'device --agx --status\r\n')
time.sleep(2)
while ser.in_waiting:
print(ser.read(ser.in_waiting).decode('utf-8', errors='replace'), end='', flush=True)
ser.close()
print('\n\nDone!')