Advertisement
Guest User

Untitled

a guest
Oct 16th, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. #include <RF24.h>
  2. #include <nRF24L01.h>
  3. #include <SPI.h>
  4.  
  5. RF24 radio(8,7);
  6. byte radReadBuffer[16];
  7.  
  8.  
  9.  
  10. void setup()
  11. {
  12.    Serial.begin(57600);
  13.    radio.begin();
  14.    radio.disableCRC();
  15.    radio.setAutoAck(false);
  16.    radio.enableDynamicPayloads();
  17.  
  18.    // adres of reciever??
  19.    const uint64_t rx_tx_addr = reinterpret_cast<const uint64_t>("\x6D\x6A\x73\x73\x73");
  20.    radio.openReadingPipe(0, rx_tx_addr);
  21.    
  22.    //mjx bind channel
  23.    radio.setChannel(8);
  24.    
  25.    radio.startListening();
  26.    Serial.println("START");
  27. }
  28.  
  29.  
  30. void loop()
  31. {
  32.       if(radio.available())
  33.       {
  34.           radio.read(radReadBuffer, 16);
  35.         Serial.println("GOT PACKET");
  36.         for(int i = 0; i < 16; i++)
  37.         {
  38.             Serial.print((int)radReadBuffer[i]);
  39.             Serial.print(" ");
  40.         }
  41.  
  42.         Serial.println("GOT PACKET END");
  43.       }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement