cuewire.serial_link
Generic Python ↔ Arduino serial link.
Classes
|
Generic integer-command bridge to a PARROTard Arduino. |
Exceptions
Raised when the Arduino fails to reply with |
- class cuewire.serial_link.ArduinoSerial(port: str | _SerialLike, baud: int = 9600, timeout: float = 0.1, comm_test_on_open: bool = True)[source]
Bases:
objectGeneric integer-command bridge to a PARROTard Arduino.
Use as a context manager:
- with ArduinoSerial(“/dev/ttyUSB0”) as ard:
ard.set_write_out(True) ard.reset_clock()
- Parameters:
port – Device path or pyserial-compatible object.
baud – Serial baud rate.
timeout – Read timeout in seconds.
comm_test_on_open – Run the
50 1337handshake on enter.
- comm_test() bool[source]
Run the
50 1337handshake; raiseCommTestErroron failure.
- send_command(name: str, settle_s: float = 0.0) None[source]
Send a named command (looked up in
COMMAND_IDS).
- send_command_verbose(name: str, settle_s: float = 1.0) str[source]
Send a named command and read the next single-line response.
- send_command_with_follow_float(name: str, follow: float, settle_s: float = 0.0) None[source]
Send a command followed by a float parameter.
- send_command_with_follow_int(name: str, follow: int, settle_s: float = 0.0) None[source]
Send a command followed by an integer parameter.
- exception cuewire.serial_link.CommTestError[source]
Bases:
RuntimeErrorRaised when the Arduino fails to reply with
50 1337.