- Tue Oct 05, 2021 10:20 am
#92546
john77 wrote:I see all prints outside like
Now I want to receive a char from a terminal
Code: Select allvoid UART_Get()
{
char chr;
if (Serial.available() > 0)
{
chr = Serial.read();
//for debug
Serial.print(chr);
}
}
and I put it in a loop
But I get nothing.
I test the RX pin with a scope and I see incoming signals on the pin.
What can be wrong?
Check the baudRate value in "Serial.begin(value);" in "void setup()". The value must be the same as configured with another device. For ESP8266 the values can be 115200 or 78880, try changing the baudRate.
Also check the RX (Arduino) -> TX (Modulo), TX (Arduino) -> RX (Modulo) connections.
You can also concatenate characters into a String:
String dataRec = "";
void UART_Get()
{
char chr;
if (Serial.available() > 0)
{
chr = Serial.read();
dataRec.concat(chr);
Serial.print(dataRec);
}
}