Python Examples
Python serial examples for Koheron V1 firmware controllers.
Firmware V1 documentation ยท V1.0-rc54-2d701ce
Koheron products currently ship with firmware V0.x by default. Firmware V1 is under active development and is not publicly available yet.
Contact us if you would like early access or want to evaluate V1 firmware on your device.
This page shows simple Python patterns for the V1 firmware serial protocol.
from serial import Serial
PORT = "/dev/ttyUSB0"
BAUD = 115200
def read_until_prompt(ser):
return ser.read_until(b">>").decode("ascii", errors="replace")
def query(ser, command):
ser.write((command + "\r\n").encode("ascii"))
ser.flush()
return read_until_prompt(ser)
Terminal equivalent:
>> version
V1.x
>> tboard
25.45
For memr and raw-binary memw, use byte-counted reads and writes for their size-prefixed binary responses instead of line-oriented helpers.