Hi! ![]()
I want to make one simple serial data logger with Arduino UNO and SD card, but I have a problem on the start ![]()
I have external UART device which send me data every second with baudrate 115200 and in next form:
U=10.0V Tmp=15.0°C Hum=76% Uptime=234s
...after 5 seconds I have 5 sentences, for example:
U=10.0V Tmp=15.0°C Hum=76% Uptime=234s
U=10.0V Tmp=15.1°C Hum=77% Uptime=235s
U=10.0V Tmp=15.2°C Hum=76% Uptime=236s
U=9.9V Tmp=15.1°C Hum=77% Uptime=237s
U=9.9V Tmp=15.1°C Hum=76% Uptime=238s
...but on Serial monitor received data are broken...
I made another test: I wrote sketch which firstly send data to serial port and then It reads If anything came in Rx buffer and then print this to Serial monitor. Function .readBytesUntil which is used in sketch has two conditions for terminate: terminator z (for test, \n is in real case) is detected and buffer (100 Byte) is full.
Sketch:
#define BUFF_MAX 100
void setup()
{
 Serial.begin(115200);
}
void loop()
{
 char inBuffer[BUFF_MAX];
 delay(1000);
 Serial.println("U=10.0V Tmp=15.0°C Hum=76% Uptime=234sz");
 while (Serial.available()>0)Â
  {   Â
  byte sizeBuffer = Serial.readBytesUntil('z', inBuffer, BUFF_MAX);
  Serial.print("Received:");
  Serial.write(inBuffer);
  Serial.println();
  }
}
...when I upload this code to UNO and open Serial monitor, I can see this:
U=10.0V Tmp=15.0°C Hum=76% Uptime=234sz
U=10.0V Tmp=15.0°C Hum=76% Uptime=234sz
U=10.0V Tmp=15.0°C Hum=76% Uptime=234sz
U=10.0V Tmp=15.0°C Hum=76% Uptime=234sz
U=10.0V Tmp=15.0°C Hum=76% Uptime=234sz
U=10.0V Tmp=15.0°C Hum=76% Uptime=234sz
...this is OK...when I make a connection between Rx(0) and Tx(1), I receive garbage...:
Received:U=10.0V Tmp=15.0°C Hum=76% Uptime=234sŮdŮ
ŮcŮvŮ:Ů1ŮŮŮ Ů5Ů
ÂŮ ŮuŮ7Ů ŮpŮmŮ2¬
Received:
Received:U=10.0V Tmp=15.0°C Hum=76% Uptime=234sŮdŮ
ŮcŮvŮ:Ů1ŮŮŮ Ů5Ů
ÂŮ ŮuŮ7Ů ŮpŮ
Received:ŮmŮ2¬
Received:
Received:U=10.0V Tmp=15.0°C Hum=76% Uptime=234sŮdŮ
ŮcŮvŮ:Ů1ŮŮŮ Ů5ŮŮ
Received:
ÂŮ ŮuŮ7Ů ŮpŮ
Received:ŮmŮ2¬
What I'm doing wrong?...Please help me.
Thank you!