1

I am having a logical error that I can not figure out with the communication. I am communicating fine with the two boards such that I can send and receive data. Code to my Transmitter and Receiver. Serial outputs here. Using library from this site: (Sorry reputation too low to add another link)

www.instructables.com/ORIG/FV6/0AAE/IBXM5ZIY/FV60AAEIBXM5ZIY.zip

(WARNING: will download with out permission if you visit link above. Use below link if dont want to download)

www.instructables.com/id/Wireless-Remote-Using-24-Ghz-NRF24L01-Simple-Tutor/?ALLSTEPS

(Scroll down to step 4, library's are labeled as "library files.zip". Names inside the zip folder are "nRF24L01" and "RF24")

From the Serial outputs I do not understand why on my transmitter it says it sent the time in milliseconds, 5873, but on my receiver output it says it received 241. Also I do not understand how the millis() function on the receiver returned a lesser value than what the transmitter should have sent.

I have novice understanding of c++ and the nRF24L01 radio at best. Any information is appreciated.

Thank you in advance!

  • 2
    Hint: 5873 = 22 x 256 + 241. It seems you transmit (or receive, or print, I did not check your code) only one byte. – jfpoilpret Jan 15 '17 at 7:49
  • @jfpoilpret Good catch. This looks like the culpret: radio.write(msg, 1); - wite just one byte from the msg start address. – Majenko Jan 15 '17 at 11:32
  • @Majenko Thank you for the feedback I changed the .write(msg, 1) to .write(msg, 2) but after a while it goes back to sending the wrong time i'm assuming the byte got larger. How would I write it to receive all bytes? – Max Palmer Jan 15 '17 at 21:01
  • A long is 4 bytes. – Majenko Jan 15 '17 at 21:02
  • Use sizeof() to get a type's lenght. Also check out github.com/TMRh20/RF24Network and RF24Mesh. – Avamander Jan 16 '17 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.