Serial Communication Printing (Solved)

void loop() {
Serial.print("{\"\");
while (!Serial.available());
i = Serial.read();
Serial.print(i);
Serial.print(" ");
while (!Serial.available());
i = Serial.read();
Serial.print(i);    
Serial.print("},\"\");

Hello I am trying to generate an output similar to this {"0 0"}, with a working code. Can anyone please help me what am I doing wrong?

Thanks

Thanks

What does the error message say?

I go a bit blind reading your snippet but it looks like you need a real " at the end of the texts where you have employed ".

There should be a real " at the beginning and end, internally to have a literal " is where you use "

a7

Serial.print("{"");
while (!Serial.available());
i = Serial.read();
Serial.print(i);
Serial.print(" ");
while (!Serial.available());
i = Serial.read();
Serial.print(i);
Serial.print(""},");

This worked for me.

Thanks

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.