Home › Forums › EasyTransfer Library Support Forum › easyTransfer methods receiving data › Reply To: easyTransfer methods receiving data
I have some working code, but I’m not sure why this works but the other didn’t
replaced :
for(int i=0; i<5; i++)
{
//remember, you could use an if() here to check for new data, this time it’s not needed.
ETin.receiveData();
txdata.address=rxdata.address;
//set our LED on or off based on what we received from the other Arduino
digitalWrite(13, rxdata.buttonstate);
//set our servo position based on what we received from the other Arduino
//we will also map the ADC value to a servo value
myservo.write(map(rxdata.servoval, 0, 1023, 0, 179));
//delay
delay(10);
}
with:
while( ! ET_RECV.receiveData() )
{
// Serial.println(“waiting for data”);
// delay(1);
;
} //end of while not received
the print and delay was just to see what was happening. Code works without them …sent address value = received. Now need to add timeout code if node doesn’t respond within a certain time.
Is there a method available for that already?