Serial issue during Li-Fi communication

Hi all,

I have setup where I have Li-Fi Transmitter(Arduino UNO + Li-Fi Transmitter Circuit) and Li-Fi Receiver(Arduino UNO + Li-Fi Receiver Circuit). Here Serial Communication is used. Li-Fi Receiver is connected to Windows built application, where the app will use the data it has received via Li-Fi.

Below JSON format message is sent from Li-Fi Transmitter:
DynamicJsonBuffer jBuffer;
JsonObject& root = jBuffer.createObject();
delay(5000);
root["WP"] = 1;
root["FL"] = 0;
root["ATA_Hours"] = 14;
root["ATA_Minutes"] = 36;
root["ATA_Seconds"] = 0;
root["Fuel_Rem"] = 8110;
root["EOP"] = 1;
root.prettyPrintTo(TXSerial);
TXSerial.println();

Below is the code in Li-Fi Receiver:
if (RXSerial.available())
{
// read the next key
Rx = RXSerial.read();
Serial.print(Rx);
}

The Serial.print(RX) is giving the below output:
{
..."WP":.2,
..."FL":.145,
..."ATA_Hours":.14,
..."ATA_Minutes":.40,
..."ATA_Seconds":.52,
..."Fuel_Rem":.7108,
..."EOP":.1
.}
.

So before this first I had standalone code where I wrote the code in JSON what is required for windows app, below is the code:
delay(5000);
root["WP"] = 1;
root["FL"] = 0;
root["ATA_Hours"] = 14;
root["ATA_Minutes"] = 36;
root["ATA_Seconds"] = 0;
root["Fuel_Rem"] = 8110;
root["EOP"] = 1;
root.prettyPrintTo(Serial);
Serial.println();

The output from this was:
{
. "WP": 1,
. "FL": 0,
. "ATA_Hours": 14,
. "ATA_Minutes": 36,
. "ATA_Seconds": 0,
. "Fuel_Rem": 8110,
. "EOP": 1
.}
.

Standalone code is recognized as JSON but the not via Li-Fi. I see some ".."(dots) appearing. I am unable to understand the same. Kindly help me on the same. Hope I have explained everything clearly.

Thanks
Mahadev

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