Hi everyone
Since 2 weeks i try hardly to use 2 NRF24L01+ with 2 teensy 3.2. the transmiter is on sparkfun (https://www.sparkfun.com/products/705)
And i've never had success with this. My project : i create a drone and a controller and i want to use this transmitter for flying command.
I've try many library, including maniac bug (https://maniacbug.wordpress.com/2011/11/02/getting-started-rf24/)
and here : https://forum.pjrc.com/threads/2430...0-and-Teensy-3-0?p=35992&viewfull=1#post35992
but in every case, it doesn't work.
First, the DEBUG_SERIAL doesn't work (i cannot open a serial monitor when i use the printDetails() method, teensy is go out).
When i try to see what i've done (when i try to transmit) i send 3 time with success and the rest is failure.
this is my class for the drone, in the controller is the same except for pipe adressing
i use a custom pinout :
PIN OUT :
MOSI -> 11
MISO -> 12
CS -> 15
CE -> 13
SCK -> 14
thank's for your help
Since 2 weeks i try hardly to use 2 NRF24L01+ with 2 teensy 3.2. the transmiter is on sparkfun (https://www.sparkfun.com/products/705)
And i've never had success with this. My project : i create a drone and a controller and i want to use this transmitter for flying command.
I've try many library, including maniac bug (https://maniacbug.wordpress.com/2011/11/02/getting-started-rf24/)
and here : https://forum.pjrc.com/threads/2430...0-and-Teensy-3-0?p=35992&viewfull=1#post35992
but in every case, it doesn't work.
First, the DEBUG_SERIAL doesn't work (i cannot open a serial monitor when i use the printDetails() method, teensy is go out).
When i try to see what i've done (when i try to transmit) i send 3 time with success and the rest is failure.
this is my class for the drone, in the controller is the same except for pipe adressing
Code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include "radio.h"
//CE,CS
RF24 radio(pinCE,pinCS);
RADIO::RADIO(){
}
void RADIO::initRADIO(uint8_t channel){
SPI.setSCK(pinSCK);
radio.begin();
radio.setChannel(channel);
radio.setDataRate(RF24_2MBPS);
radio.setPALevel(RF24_PA_MAX);
radio.setAutoAck(1);
radio.setRetries(15,15);
radio.setCRCLength(RF24_CRC_8);
radio.setPayloadSize(8);
radio.openWritingPipe(addresses[1]);
radio.openReadingPipe(1,addresses[0]);
radio.startListening();
//powerOnRadio();
//radio.printDetails();
}
void RADIO::transmitRADIO(String message){
radio.stopListening();
radio.write(&message,sizeof(message));
radio.startListening();
}
String RADIO::receiveRADIO(){
unsigned long started_waiting_at = millis();
bool timeout = false;
String msg = "";
while ( ! radio.available() && ! timeout ) {
if (millis() - started_waiting_at > 200 ) timeout = true;
}
if ( timeout )
{
return "Failed, response timed out" ;
}
else
{
radio.read( &msg, sizeof(String));
return msg;
}
}
void RADIO::powerOnRadio(){
radio.powerDown();
powerOn=true;
}
void RADIO::powerOffRadio(){
radio.powerUp();
powerOn=false;
}
boolean RADIO::isPowerOn(){
return powerOn;
}
i use a custom pinout :
PIN OUT :
MOSI -> 11
MISO -> 12
CS -> 15
CE -> 13
SCK -> 14
thank's for your help