I have a Nano, and a Teensy 3.1
Both have the RF24L01+ modules wired to the same pins and are both running this RF receiver sketch:
Both are connected to RF24L01+ modules (same batch, same vendor)
When each receives the same data, they display different results. What did I do wrong?
Nano displays the radio.printDetails() from Setup() along with:
Teensy won't display the radio.printDetail() and only displays:
The (simplified) Sending code on the transmitting device looks like this:
I'm guessing that the Teensy handles Serial.printLn() differently, or sees the data on the SPI differently? Any clues?
Both have the RF24L01+ modules wired to the same pins and are both running this RF receiver sketch:
Code:
#include <SPI.h>
#include <Wire.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24_config.h>
#include <printf.h>
// D7 CE (SPI) RF24
// D8 CSN (SPI) RF24
// D11 MOSI (SPI) RF24
// D12 MISO (SPI) RF24
// D13 SCK (SPI) RF24
// RF 24
RF24 radio(7,8);
const uint64_t pipe = 0xE8E8F0F0E1LL; // Send and receive share the same pipe for now)
struct dataStruct{int command; int value;}myData;
void setup()
{
Serial.begin(9600);
Serial.println("Startup...");
// RF24 Radio Setup
radio.begin();
radio.setPALevel(RF24_PA_MAX);
radio.setRetries(15,15);
radio.setDataRate(RF24_250KBPS);
radio.setRetries(0,2); // Retry 2 times with 250us delay between retries.
radio.openReadingPipe(1,pipe);
radio.openWritingPipe(pipe);
radio.startListening();
printf_begin();
radio.printDetails(); // dumps the radio data (to see if it is even connected)
}
void loop(void)
{
if (radio.available())
{
Serial.println("I see something...");
//radio.printDetails(); // dumps the radio data (to see if it is even connected)
GetRadioData();
}
}
void GetRadioData(void)
{
// Serial.println("Getting radio message");
bool tx,fail,rx;
radio.whatHappened(tx,fail,rx); // What happened?
if (rx)
{
while (radio.available()) // While there is data ready
{
radio.read(&myData, sizeof(myData)); // Get the payload
}
}
Serial.print("Command:");
Serial.print(myData.command);
Serial.println("");
Serial.print("Value:");
Serial.print(myData.value);
Serial.println("");
}
Both are connected to RF24L01+ modules (same batch, same vendor)
When each receives the same data, they display different results. What did I do wrong?
Nano displays the radio.printDetails() from Setup() along with:
Code:
I see something...
Command:66
Value:89
Teensy won't display the radio.printDetail() and only displays:
Code:
I see something...
Command:5832770
Value:0
The (simplified) Sending code on the transmitting device looks like this:
Code:
struct dataStruct{int command; int value;}myData;
radio.stopListening();
myData.command = 66;
myData.value = 89;
radio.write( &myData, sizeof(myData) );
radio.startListening();
I'm guessing that the Teensy handles Serial.printLn() differently, or sees the data on the SPI differently? Any clues?
Last edited: