Guest User

Untitled

a guest
Oct 25th, 2016
220
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <nRF905.h>
  2. #include <SPI.h>
  3.  
  4. #define RXADDR {0x58, 0x6F, 0x2E, 0x10} // Address of this device (4 bytes)
  5. #define TXADDR {0xFE, 0x4C, 0xA6, 0xE5} // Address of device to send to (4 bytes)
  6.  
  7. #define ENQ {0x05}
  8. #define ACK {0x06}
  9. #define SOH {0x01}
  10. String reply;
  11. String replyH;
  12. String frame;
  13.  
  14. void setup() {
  15. nRF905_init();
  16. byte addr[] = RXADDR;
  17. nRF905_setRXAddress(addr);
  18. byte addr1[] = TXADDR;
  19. nRF905_setTXAddress(addr1);
  20. nRF905_receive();
  21. Serial.begin(9600);
  22. }
  23.  
  24. void loop() {
  25. /******************WAIT FOR ENQUIRY (RECEIVE)*******************/
  26. reply = "\0";
  27. Serial.println("WAITING FOR ENQ");
  28. byte buffer[16] = {0};
  29. while (!nRF905_getData(buffer, sizeof(buffer)));
  30. nRF905_setData(buffer, sizeof(buffer));
  31. while (!nRF905_send());
  32. nRF905_receive();
  33. Serial.print(F("Data: "));
  34. Serial.write(buffer, sizeof(buffer));
  35. Serial.println(buffer[0]);
  36. Serial.println(" ");
  37. }
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.

×