-
Notifications
You must be signed in to change notification settings - Fork 0
Pi link library
The Raspberry Pi side of Pi2Ard is based on the Link class in Pi-lib/link.py, which handles the data coming from the Arduino. This part requries the pySerial library.
- Arguments:
port = None
- Returns: bool
Returns True
if the given port is available and False
if not.
Clears in the input buffer by calling serial.Serial.reset_input_buffer()
.
- Arguments:
baudRate = None, port = None
Opens the connection to the Arduino. The default baudrate is 9600. If the given port is None
, it will attempt to find the default port for Windows and Linux (COM3 and /dev/ttyACM0, respectively).
Closes the connection to the Arduino.
- Returns: bool
As its name suggests, this returns True
if the connection is open, returns False
otherwise.
Checks to see if there is any data in the input buffer. If there is, it will trigger the callback function (passing the data as its argument. This uses serial.Serial.readline()
to obtain the data as a bytes array.
- Arguments:
func
Sets the callback function for the receive()
function. This callback function must have one argument, which will be the new data received as a bytes array.