//sender's I am trying to transfer unsigned int
values between 2 Arduinos. When sending 61805
for the first 8-9 times, I am getting 61805. But after then after these numbers: 61937 28013 61937.
Sender's code:
```unsigned int s = 0;
void setup ()
{
Serial.begin(9600) ;
}
void loop()
{
s = 61805;
Serial.write(highByte(s)) ;
Serial.write(lowByte(s));
}
unsigned int s = 0;
void setup ()
{
Serial.begin(9600) ;
}
void loop()
{
s = 61805;
Serial.write(highByte(s)) ;
Serial.write(lowByte(s));
}
Receiver's code:
//receiver's code
unsigned int upperByte, lowerByte, r=0,p=0;
void setup()
{
Serial.begin(9600);
}
void loop ()
{
if (Serial.available() > 1 )
{
upperByte = Serial.read();
lowerByte = Serial.read();
}
r = (upperByte << 8) + lowerByte ;lowerByte;
Serial.println(r);
}