I am sending voltage, current, power and energy string from one arduino to another but facing some problem. When the sending string is received at another arduino it not as desired.
The program files of both arduino is attached in the attachment and the screenshot of the serial monitor of both arduino are also attached. The data at the receiving end should be like the data at the sending send but it differs due to some errors.
PZEM_grid_End.ino (2.78 KB)
PZEM_LOAD_END.ino (2.22 KB)
There are a couple problems. The first is that your PZEM_LOAD_END.ino is printing a lot of output to Serial that the PZEM_grid_End.ino code is not written to handle. In PZEM_LOAD_END.ino, you seem to be trying to use Serial to print debug output as well as the date you are trying to send to the Arduino running PZEM_grid_End.ino. That's not going to work without some changes to the PZEM_grid_End.ino code.
The second problem is that you don't correctly clear receivestring_ch in PZEM_grid_End.ino. You have this ridiculous line:
Serial.print(); // clear the receivestring_ch
which certainly doesn't do what the comment claims, and doesn't even compile (at least not for Arduino AVR Boards, I don't know what board you're using).
You make a somewhat better attempt here:
receivestring_ch = " ";//
but how is that going to work with this?:
You set receivestring_ch to " ". That means it still has length 1.
You really need to spend some time to understand what each line of code does, rather than copy/pasting a bunch of stuff together in the hopes it might chance to work. It might seem slower to go back and learn some fundamentals, but in the end it's faster and much less frustrating.
Please post your codes online in the post page using code tags(</>) with clear indications like these:
This is Sender/Transmitter (UNO/NANO/MEGA) Code:
This is Receiver (UNO/NANO/MEGA) Code:
The attached files are not guaranteed to be opened in all computers as I can’t open your one file.