Repository navigation
Serial Port
Programs and dependencies that communicate near real time with a serial port.
Use the arduinoSerial.ino as a source for serial port data. The sketch simply reads an integer value from an Analog pin and writes it as bytes with a two byte header check.
Using the MAVlink serial port library, a program was written to decode the serial data from the Arduino sketch. Update the parameters below and then make the program and run.
// Set up the serial port
serial_port.uart_name = "/dev/cu.usbmodem14101";
serial_port.baudrate = 9600;
Inspired by this awesome blog post. A background thread is created for reading a serial port so that the main thread running a computationally intensive task (e.g. - real time plotting) will always have access to the most up to date information. Update the parameters and the custom class will take care of the rest:
# Connect to serial port
portName = '/dev/cu.usbmodem14101'
baudRate = 9600
dataNumBytes = 2
numSignals = 1
See the MATLAB folder two different methods of reading in serial data. The tutorial link can be found here.