Wittecactus
Member
Hi all,
I am working on a quadruped robot with a Teensy 4.0 onboard with a NRF24L01. I want to control this robot with a remote. This remote uses an Arduino Mega in combination with the NRF24L01.
Everything is working on the robot (IVK, input of joysticks, walking sequence), so now I want to operate it remotely. Therefore I first want to do a simple test: Make contact by sending a simple message between the Arduino Mega and the Teensy 4.0.
I have made the following code for the transmitter (Arduino Mega):
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
void setup() {
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_HIGH);
radio.stopListening();
}
void loop() {
const char text[] = "Test";
radio.write(&text, sizeof(text));
delay(1000);
}
For the receiver (Teensy), I used this code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_HIGH);
radio.startListening();
}
void loop() {
if (radio.available()) {
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
}
Now the problem is that the Teensy does not receive anything. I also tested the receiver code on an Arduino Uno and then the code does work and the message is received. So I think it has something to do with teensy and the SPI. This is also my first time working with a Teensy. I tried numerous things (like this solution //SPI.beginTransaction(SPISettings(400000000, MSBFIRST, SPI_MODE0));, setting the pins, trying other example codes....) from all other forum posts, but nothing works.
Can someone help me with this problem? Thanks already.
(I could not upload my pictures so therefore this photo link for the wiring: https://photos.app.goo.gl/wVS7FT6FZuFbQL9w8 )
I am working on a quadruped robot with a Teensy 4.0 onboard with a NRF24L01. I want to control this robot with a remote. This remote uses an Arduino Mega in combination with the NRF24L01.
Everything is working on the robot (IVK, input of joysticks, walking sequence), so now I want to operate it remotely. Therefore I first want to do a simple test: Make contact by sending a simple message between the Arduino Mega and the Teensy 4.0.
I have made the following code for the transmitter (Arduino Mega):
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
void setup() {
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_HIGH);
radio.stopListening();
}
void loop() {
const char text[] = "Test";
radio.write(&text, sizeof(text));
delay(1000);
}
For the receiver (Teensy), I used this code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_HIGH);
radio.startListening();
}
void loop() {
if (radio.available()) {
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
}
Now the problem is that the Teensy does not receive anything. I also tested the receiver code on an Arduino Uno and then the code does work and the message is received. So I think it has something to do with teensy and the SPI. This is also my first time working with a Teensy. I tried numerous things (like this solution //SPI.beginTransaction(SPISettings(400000000, MSBFIRST, SPI_MODE0));, setting the pins, trying other example codes....) from all other forum posts, but nothing works.
Can someone help me with this problem? Thanks already.
(I could not upload my pictures so therefore this photo link for the wiring: https://photos.app.goo.gl/wVS7FT6FZuFbQL9w8 )