Advertisement
Guest User

Untitled

a guest
Apr 1st, 2014
116
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. typedef struct{
  2.     int num1;
  3.     int num2;
  4.     int num3;
  5.     int num4;
  6.     int num5;
  7. } numbers_s;
  8.  
  9. numbers_s myNumbers;
  10.  
  11. void main()
  12. {
  13.  
  14. }
  15.  
  16. void loop()
  17. {
  18.     // For sending:
  19.  
  20.     // Set some numbers
  21.     myNumbers.num1 = 5;
  22.     myNumbers.num2 = 4;
  23.     myNumbers.num3 = 77;
  24.     myNumbers.num4 = 865;
  25.     myNumbers.num5 = 6254;
  26.  
  27.     // Set data
  28.     nRF905_setData(&myNumbers, sizeof(myNumbers));
  29.  
  30.     delay(1000);
  31.  
  32.     // For receiving:
  33.  
  34.     // See if we've got data
  35.     if(nRF905_getData(&myNumbers, sizeof(myNumbers)))
  36.     {
  37.         // Print data
  38.         Serial.println(myNumbers.num1);
  39.         Serial.println(myNumbers.num2);
  40.         Serial.println(myNumbers.num3);
  41.         Serial.println(myNumbers.num4);
  42.         Serial.println(myNumbers.num5);
  43.     }
  44. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement