Skip to content

Latest commit

 

History

History
20 lines (11 loc) · 1019 Bytes

File metadata and controls

20 lines (11 loc) · 1019 Bytes

Hardware Serial Console

This example is similiar to Hello World example except this time we are connecting trough RS232 serial port using TTL RS232 conventer:

Hardware Serial Console

You can connect it to your PC with USB to RS232 conventer or with ordinary serial cable if you have serial port on your PC.

Usage if pretty much the same as with Serial1. Here is echo example:

#define RXD2 16
#define TXD2 17
void setup() {
// Setup Serial2 on GPIO pins
Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
}
void loop() {
// Check if there is data comming
if (Serial2.available()) {
// Read string until newline character
String str = Serial2.readStringUntil('\n');
Serial2.println("String: " + str);
}
}

Fritzing parts

Sources