Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <EasyTransfer.h>
- //create object
- EasyTransfer ET;
- struct RECEIVE_DATA_STRUCTURE{
- //put your variable definitions here for the data you want to receive
- //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
- String ahoj;
- };
- //give a name to the group of data
- RECEIVE_DATA_STRUCTURE mydata;
- void setup(){
- Serial.begin(115200);
- Serial1.begin(9600);
- //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
- ET.begin(details(mydata), &Serial1);
- pinMode(13, OUTPUT);
- }
- void loop(){
- //check and see if a data packet has come in.
- if(ET.receiveData()){
- //this is how you access the variables. [name of the group].[variable name]
- //since we have data, we will blink it out.
- Serial.println(mydata.ahoj);
- }
- //you should make this delay shorter then your transmit delay or else messages could be lost
- delay(250);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement