Aria
2.8.0
|
Demonstrates the use of a robot packet handler to recieve data from a device attached to the robot microcontroller's auxilliary serial port.This example shows how to use the GETAUX command and how to recieve SERAUX serial port data. To use this example, you must have the auxilliary serial port AUX1 on the microcontroller (inside the robot) connected to a device that is sending text data.
You can connect AUX1 to a computer through an RS-232 cable with a NULL modem adapter, and run a program such as minicom (Linux) or HyperTerminal (Windows). Then just type to send data to the AUX1 port. Configure minicom or HyperTerminal to have the following serial port settings: 9600 baud 8 data bits, 1 stop bit, no parity No flow control (not hardware, not software)!
This program creates a packet handler function (getAuxPrinter) and adds it to the ArRobot object. All packets recieved from the robot are passed to all packet handlers. getAuxPrinter() checks whether the packet is an SERAUX packet, and if so, prints out the data contained within the packet. If a newline or carriage return character is recieved, then it sends a command to send data back out through the AUX serial port. The packet handler then sends a GETAUX command to the robot to request more data.