SHARE
TWEET

Untitled

a guest Jun 26th, 2014 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <nRF905.h>
  2. #include <SPI.h>
  3.  
  4. void setup()
  5. {
  6.         // Start up
  7.         nRF905_init();
  8.  
  9.         // Put into receive mode
  10.         nRF905_receive();
  11.  
  12.         Serial.begin(9600);
  13.  
  14.         Serial.println(F("Server started"));
  15. }
  16.  
  17. void loop()
  18. {
  19.         Serial.println(F("Waiting for data..."));
  20.  
  21.         // Make buffer for data
  22.         byte buffer[NRF905_MAX_PAYLOAD];
  23.  
  24.         // Wait for data
  25.         while(!nRF905_getData(buffer, sizeof(buffer)));
  26.  
  27.         Serial.println(F("Got data"));
  28.  
  29.         int val;
  30.         memcpy(&val, buffer, sizeof(val));
  31.  
  32.         Serial.println(val);
  33.  
  34.         // Put back into receive mode
  35.         nRF905_receive();
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top