Serial

Used for communication between the 86Duino board and a computer or other devices. All 86Duino boards have at least one serial port (also known as a UART or USART): Serial1. It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer (via a TTL USB-to-serial adaptor). Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output.

You can use the 86Duino or Arduino environments’ built-in serial monitor to communicate with an 86Duino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to begin().

The 86Duino One and EduCake have two additional serial ports: Serial2 on pins 17 (RX) and 16 (TX) and Serial3 on pins 15 (RX) and 14 (TX). To use these pins to communicate with your personal computer, you will also need an additional TTL USB-to-serial adaptor. To use them to communicate with an external TTL serial device, connect the TX pin to your device’s RX pin, the RX to your device’s TX pin, and the ground of your 86Duino to your device’s ground. (Don’t connect these pins directly to an RS232 serial port; RS232 ports operate at +/- 12V and can damage your 86Duino board.)

Additionally, for all 86Duino boards, there is a native USB-serial port, Serial. This port is used for USB CDC communication, and its usage is the same as the Arduino Leonardo. For more information, you may refer to the Arduino Leonardo getting started page and hardware page.

86Duino-Specific Half-Duplex Mode

Each of the TTL serial ports Serial1, Serial2, and Serial3 supports the half-duplex mode, in which you can transmit and receive serial data using only the TX pin. This mode allows that you connect 86Duino directly to certain of AI servos, such as Robotis Dynamixel AX-12, without external tri-state interface circuits. The half-duplex mode can be selected by the begin() function of Serial1, Serial2, and Serial3.

The RS232 and RS485 Serial Ports

The 86Duino EduCake and 86Duino PLC support a 9-pin RS232 serial port, operating at +/- 12V, and you can access it using Serial232. The 86Duino One and 86Duino PLC support a RS485 serial port and you can access it using Serial485.

The usage of both Serial232 and Serial485 is the same as Serial1, Serial2, and Serial3, but the half-duplex mode isn’t defined for these two ports.

Functions

if (Serial)
available()
begin()
end()
find()
findUntil()
flush()
parseFloat()
parseInt()
peek()
print()
println()
read()
readBytes()
readBytesUntil()
setTimeout()
write()
serialEvent()

Examples

The following are Serial examples from the Arduino Tutorial that can work on the 86Duino boards:

ReadASCIIString
ASCII Table
Dimmer
Graph
Physical Pixel
Virtual Color Mixer
Serial Call Response
Serial Call Response ASCII


Language Reference Home

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.