mirror of
https://github.com/lowobservable/coax.git
synced 2026-01-23 03:07:47 +00:00
36 lines
628 B
Python
Executable File
36 lines
628 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import sys
|
|
import time
|
|
from serial import Serial
|
|
|
|
sys.path.append('..')
|
|
|
|
from coax import Interface1, poll, poll_ack
|
|
|
|
print('Opening serial port...')
|
|
|
|
with Serial('/dev/ttyUSB0', 115200) as serial:
|
|
print('Sleeping to allow interface time to wake up...')
|
|
|
|
time.sleep(3)
|
|
|
|
interface = Interface1(serial)
|
|
|
|
print('Resetting interface...')
|
|
|
|
version = interface.reset()
|
|
|
|
print(f'Firmware version is {version}')
|
|
|
|
print('POLL...')
|
|
|
|
poll_response = poll(interface, timeout=5)
|
|
|
|
print(poll_response)
|
|
|
|
if poll_response:
|
|
print('POLL_ACK...')
|
|
|
|
poll_ack(interface)
|