Guest User

Untitled

a guest
Oct 8th, 2016
107
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}
  5. #define TXADDR {0xFE, 0x4C, 0xA6, 0xE5}
  6.  
  7.  
  8. void setup() {
  9. nRF905_init();
  10. byte addr[] = RXADDR;
  11. nRF905_setRXAddress(addr);
  12. nRF905_receive();
  13. Serial.begin(9600);
  14. Serial.println(F("Server started"));
  15. }
  16.  
  17. void loop () {
  18.  
  19. Serial.println(F("Waiting for data..."));
  20. byte payload[NRF905_MAX_PAYLOAD];
  21.  
  22. if (!nRF905_getData(payload, sizeof(payload)) == true) { //may nreceive
  23. Serial.println(F("Got data"));
  24. Serial.print(F("Data: "));
  25. Serial.write(payload, sizeof(payload));
  26. Serial.println();
  27. delay(300);
  28. }
  29. if (!nRF905_getData(payload, sizeof(payload)) == false) { //walang data
  30. Serial.println(F("No data"));
  31. Serial.write(payload, sizeof(payload));
  32. Serial.println();
  33. delay(300);
  34. }
  35.  
  36. }
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.

×