More members will see your code if posted properly. Read the how to use this forum-please read sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.
You are sending data awfully fast. How fast do you really need to send data? How fast can the servo respond?
I have 2 Unos set up with rf24 radios and tried your code on them. I had to change the CE and CSN pins to match my setup. I also changed the sending code to send hard coded test values and included a timer to slow the data sending down. Code seems to work fine for me. I get values at the expected rate (10Hz).
Are your servos powered by an external supply?
Modified send code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN // Radio Setup
const byte address[6] = "00001";
int ThrustPin = 2; // select the input pin for the potentiometer
int PitchPin = 3;
int YawPin = 4;
int ThrustVal, PitchVal, YawVal, intValues = 0;
String Thrust, Pitch, Yaw, values;
void setup()
{
Serial.begin(9600);
radio.begin(); // Radio setup
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN); // Change for flight
radio.stopListening();
}
void loop()
{
static unsigned long timer = 0;
unsigned long interval = 100;
if (millis() - timer >= interval)
{
timer = millis();
ThrustVal = analogRead(ThrustPin); // Read Pot Values
PitchVal = analogRead(PitchPin);
YawVal = analogRead(YawPin);
ThrustVal = map(ThrustVal, 0, 430, 1000, 2000); // Convert Pot values to 1000-2000
if (PitchVal >= 569)
PitchVal = map(PitchVal, 569, 1023, 1500, 2000);
else
PitchVal = map(PitchVal, 0, 569, 1000, 1500);
if (YawVal >= 505)
YawVal = map(YawVal, 505, 1023, 1500, 2000);
else
YawVal = map(YawVal, 0, 505, 1000, 1500);
int int_array[3]; // Put pot values into an array
int_array[0] = 1500; //map(ThrustVal,1000,2000,0,180);
int_array[1] = 1000; //map(PitchVal,1000,2000,0,180);
int_array[2] = 2000; //map(YawVal,1000,2000,0,180);
radio.write(&int_array, sizeof(int_array)); //send radio signal
}
}
Receive code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <ServoTimer2.h>
ServoTimer2 servoElevator;
int Thrust, Pitch, Yaw;
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";
void setup()
{
radio.begin(); //Radio Setup
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
Serial.begin(9600);
servoElevator.attach(3); //Servo Setup
}
void loop()
{
if (radio.available())
{
int int_array[3];
radio.read(&int_array, sizeof(int_array));
Thrust = int_array[0];
//Pitch = int_array[1];
//Yaw = int_array[2];
Serial.println(Thrust);
servoElevator.write(Thrust); //
}
}