Chagrin:
If you're looking for dead simple, take a look at: EasyTransfer Arduino Library « The Mind of Bill Porter
There are lots of examples in the GitHub repository if you dig through: GitHub - madsci1016/Arduino-EasyTransfer: An Easy way to Transfer data between Arduinos
I've tried this before but nothing works...
Can you inspect my code for error?
Sender arduino:
#include <EasyTransfer.h>
EasyTransfer ETout;
int potpin1 = 0;
int potpin2 = 1;
struct SEND_DATA_STRUCTURE{
int servo1val;
int servo2val;
};
SEND_DATA_STRUCTURE txdata;
void setup(){
Serial.begin(115200);
ETout.begin(details(txdata), &Serial);
pinMode(potpin1, INPUT);
pinMode(potpin2, INPUT);
}
void loop(){
txdata.servo1val = analogRead(potpin1);
txdata.servo2val = analogRead(potpin2);
ETout.sendData();
}
receiver arduino:
#include <Servo.h>
#include <EasyTransfer.h>
EasyTransfer ET, ETin;
Servo myservo1;
Servo myservo2;
struct RECEIVE_DATA_STRUCTURE{
int servo1val;
int servo2val;
};
RECEIVE_DATA_STRUCTURE txdata;
void setup(){
Serial.begin(115200);
ETin.begin(details(txdata), &Serial);
myservo1.attach(9);
myservo2.attach(10);
}
void loop(){
if(ET.receiveData()){
myservo1.write(map(txdata.servo1val, 0, 1023, 0, 179));
myservo2.write(map(txdata.servo2val, 0, 1023, 0, 179));
delay(10);
}
}
Is there an error? but in compiling it is ok.