Advertisement
Guest User

Untitled

a guest
May 26th, 2022
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <EasyTransfer.h>
  2.  
  3. //create object
  4. EasyTransfer ET;
  5.  
  6. struct RECEIVE_DATA_STRUCTURE{
  7. //put your variable definitions here for the data you want to receive
  8. //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  9. String ahoj;
  10. };
  11.  
  12. //give a name to the group of data
  13. RECEIVE_DATA_STRUCTURE mydata;
  14.  
  15. void setup(){
  16. Serial.begin(115200);
  17. Serial1.begin(9600);
  18. //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
  19. ET.begin(details(mydata), &Serial1);
  20.  
  21. pinMode(13, OUTPUT);
  22.  
  23. }
  24.  
  25. void loop(){
  26. //check and see if a data packet has come in.
  27. if(ET.receiveData()){
  28. //this is how you access the variables. [name of the group].[variable name]
  29. //since we have data, we will blink it out.
  30. Serial.println(mydata.ahoj);
  31. }
  32.  
  33. //you should make this delay shorter then your transmit delay or else messages could be lost
  34. delay(250);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement