Hello, I stumbled upon a issue where 2 arduinos with simple serial code that is supposed to send values in the range of 0-180 while they only recieved bytes are in the range 40-60 (the sender code works normally with Serial.print)
Lab_Gaming:
while they only recieved bytes are in the range 40-60 (the sender code works normally with Serial.print)
Without seeing your program how can we help?
Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.
The technique in the 3rd example will be the most reliable.
You can send data in a compatible format with code like this
Serial.print works fine, Serial.write is the problem. As for the code it’s a simple analogRead mapped to 0-180 and the mapped value is being sent via serial.
Lab_Gaming:
Serial.print works fine, Serial.write is the problem.
Did you know? write() sends out binary raw data, while print() send out a textual representation of that value (although a single char still counts as raw data).
Lucario448:
Did you know? write() sends out binary raw data, while print() send out a textual representation of that value (although a single char still counts as raw data).
That is just the sending code. You need to post the receiving code as well - they must work as a pair. How will the receiving program determine which is the first value?
And please post your program using the code button </>