Code written for communication using nrf24l01+ works if I use two arduino UNOs.
But when I try to upload the same code for receiver to teensy3.1 using the same nrf24l01+ board, it does not work.
All I can see on serial monitor is "tick". No data is received.
"Sender" runs on Arduino UNO.
SPI library is standard arduino library.
Pin connection for arduino and teensy is the same:
controller ->nrf
gnd -> 1
vcc -> 2
9 -> 3
10 -> 4
11 -> 6
12 ->7
13 ->5
irq(8) is not connected(black wire)
All connections are tested.
Arduino IDE version 1.0.5
Teensy version 1.18rc2
Code and photos of connections are attached.
Code for receiver:
Code for transmitter:
RF24 library:
View attachment nRF24L01.h
View attachment RF24_config.h
View attachment RF24.cpp
View attachment RF24.h
But when I try to upload the same code for receiver to teensy3.1 using the same nrf24l01+ board, it does not work.
All I can see on serial monitor is "tick". No data is received.
"Sender" runs on Arduino UNO.
SPI library is standard arduino library.
Pin connection for arduino and teensy is the same:
controller ->nrf
gnd -> 1
vcc -> 2
9 -> 3
10 -> 4
11 -> 6
12 ->7
13 ->5
irq(8) is not connected(black wire)
All connections are tested.
Arduino IDE version 1.0.5
Teensy version 1.18rc2
Code and photos of connections are attached.
Code for receiver:
Code:
#include <SPI.h>
#include "RF24.h"
/********** radio ************/
RF24 radio(9,10); // Set up nRF24L01 radio on SPI bus plus pins 9 & 10
const uint64_t reading_pipe = 0xF0F0F0F0E2LL;
void init_radio(void){
radio.begin();
radio.setRetries(1,0);
radio.setCRCLength(RF24_CRC_16);
radio.setAutoAck(false);
radio.setPayloadSize(sizeof(int));
radio.openReadingPipe(1,reading_pipe);
radio.startListening();
}
#define RECEIVE_DELAY_MICROS 3300
void transfer_all_payloads(void){
int data = 0;
radio.read(& data,sizeof(int));
Serial.println(data);
}
void setup(void)
{
Serial.begin(115200);
init_radio();
}
void loop(void)
{
Serial.println("tick");
if(radio.available()){
transfer_all_payloads();
}
delay(1000);
}
Code for transmitter:
Code:
#include <SPI.h>
#include "RF24.h"
/************************* radio *****************/
RF24 radio(9,10); // Set up nRF24L01 radio on SPI bus plus pins 9 & 10
const uint64_t writing_pipe = 0xF0F0F0F0E2LL;
void init_radio(void){
radio.begin();
radio.setRetries(1,0);
radio.setAutoAck(false);
radio.setCRCLength(RF24_CRC_16);
radio.setPayloadSize(sizeof(int));
radio.openWritingPipe(writing_pipe);
}
void setup(void)
{
Serial.begin(115200);
init_radio();
}
void loop(void)
{
for(int i=0;i<1000;i++){
Serial.print("sending ");
Serial.println(i);
radio.startWrite(& i,sizeof(int));
delay(1000);
}
}
View attachment nRF24L01.h
View attachment RF24_config.h
View attachment RF24.cpp
View attachment RF24.h