Hi all!
This may be a simple answer from many in the forum, but for me its been a struggle.
I'm able to send a request in the format of serial of 8bytes data. hence query to a RTU device.
in return the device responds via serial with 13bytes.
I can sort of read the bytes via:
if (Serial.available() > 0) {
incomingByte = Serial.read();
lcd.setCursor(1, 1); ( external I2C screen)
lcd.print(incomingByte);
}
The Question is, How can I save the 13 bytes received in order to be used later.
this is the request:
11,03,00,54,00,04,07,49
this is the expected response:
11,03,08,00,64,00,3E,00,0D,00,55,9C,E8
Wouldn't incomingByte[counter] = Serial.read(); work better? @P B
Using libraries being tested and ready is of course favorable for lots of members but doing the hard work is very educating for those being interested in the back stage work
If the sending device always concludes its message with an end-marker byte (for example a line-feed character) then have a look at the second example in Serial Input Basics
Railroader:
Wouldn't incomingByte[counter] = Serial.read(); work better? @P B
Using libraries being tested and ready is of course favorable for lots of members but doing the hard work is very educating for those being interested in the back stage work
Ehh?
I made a remark to the suggestion made by @CrossRoads.
My opinion about libs or not? Of cource, OP descides.
Another thought. Should members like You and me support the questioning member or run private discussions above the head of OP? I admit, it's easy to fall in that trap.
Hi all!
Thanks for the replies!
After putting kids,pets,and wife to sleep, FINALLY got some time to test !!
I do not know how to code per say but learning as we go along.
After couple of changes to the First reply got some results!
and thanks to you guys I can print the byte received all 13, and have the array to work with!
here is a Video:
I did used and tried couple Libraries, but most had timing issues at sending request or receiving it, maybe because I'm using a NodeMcu ESP8266. and most did not have all (0-16) function registers working.
anyways I love to learn step at a time and understand how libraries work in the background.