Advertisement
Guest User

Untitled

a guest
Mar 13th, 2014
197
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.  
  33.  
  34.  
  35.     // For receiving:
  36.  
  37.     // Wait for data
  38.     while(!nRF905_getData(&myNumbers, sizeof(myNumbers)));
  39.  
  40.     // Print data
  41.     Serial.println(myNumbers.num1);
  42.     Serial.println(myNumbers.num2);
  43.     Serial.println(myNumbers.num3);
  44.     Serial.println(myNumbers.num4);
  45.     Serial.println(myNumbers.num5);
  46. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement