Guest User

Untitled

a guest
Sep 13th, 2015
235
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include <nRF905.h>
  3. #include <SPI.h>
  4.  
  5. #define RXADDR {0x58, 0x6F, 0x2E, 0x10} // Address of this device (4 bytes)
  6. #define TXADDR {0xFE, 0x4C, 0xA6, 0xE5} // Address of device to send to (4 bytes)
  7.  
  8. void setup()
  9. {
  10.     // Start up
  11.     nRF905_init();
  12.    
  13.     // Set address of this device
  14.     byte addr[] = RXADDR;
  15.     nRF905_setRXAddress(addr);
  16.  
  17.     // Put into receive mode
  18.     nRF905_receive();
  19.  
  20.     Serial.begin(9600);
  21.  
  22.     Serial.println(F("Server started"));
  23. }
  24.  
  25. void loop()
  26. {
  27.     Serial.println(F("Waiting for data..."));
  28.  
  29.     // Make buffer for data
  30.     byte buffer[NRF905_MAX_PAYLOAD];
  31.  
  32.     // Wait for data
  33.     while(!nRF905_getData(buffer, sizeof(buffer)));
  34.  
  35.     Serial.println(F("Got data"));
  36.  
  37.     // Print out ping contents
  38.     Serial.print(F("Data: "));
  39.     Serial.write(buffer, sizeof(buffer));
  40.     Serial.println();
  41. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×