The C++ test marquee driver that cycles the FIRST Team 7587, Metuchen Momentum LED Marquee through a sequence of images. Because it's written in C++, it can run from computers that cannot support Java. We need to write an analogous program in Java as a proof of concept for the Robo-Rio Marquee control code.
This program runs from a Linux terminal.
The program works as follows:
The program does the following
- Locate and configure the serial USB connection to the ESP32 Marquee controller,
whose paths are either
- '/dev/ttyUSBn'
- '/dev/ttyACMn' where 'n' is a digit
- Open the USB connection on two file handles, one for read and the other for write.
- Starts a thread that runs the microcontroller monitor in parallel with the main logic. The monitor simply reads from the serial connection and prints the results on the terminal.
- Loop forever, sending a sequence of commands to the controller
The FindSerialUsb
class constructor implements the class logic. It
- Scans the /dev/ directory looking for files that match ]
/dev/ttyUSB*
and/dev/ttyACM*
, the serial USB devices connected to microcontrollers. - Makes the device path available for use by the main program.
The USBStreams class configures the serial connection, setting speed, parity, character length, and so on, and then opens two file handles on the device, one for writing (the more important), and the other for reading. A complete description of UART/Serial I/O settings is way beyond the scope of this document. Please see the references section for more information.
- The
fdatasync
invocation at line 60 inmain.cpp
should probabaly be changed tofsync
.
Please see the following for further information.