#include #include #include #include Servo myServo1; Servo myServo3; Servo myServo4; Servo myServo2; Servo myServo5; RF24 radio(9, 10); // CE, CSN const byte address[6] = "00001"; boolean button_state = 0; int msg[5]; int led_pin = 3; void setup() { myServo1.attach(17); //A1 myServo2.attach(16); //A2 myServo3.attach(15); //A3 myServo4.attach(18); //A4 myServo5.attach(19); //A5 pinMode(6, OUTPUT); Serial.begin(9600); radio.begin(); radio.openReadingPipe(0, address); //Setting the address at which we will receive the data radio.setPALevel(RF24_PA_MIN); //You can set this as minimum or maximum depending on the distance between the transmitter and receiver. radio.startListening(); //This sets the module as receiver } void loop() { if (radio.available()) //Looking for the data. { radio.read(msg, sizeof(msg)); myServo1.write(msg[4]); //A1 myServo2.write(msg[3]); //A2 myServo3.write(msg[2]); //A3 myServo4.write(msg[1]); //A4 myServo5.write(msg[0]); //A5 char text[32] = ""; //Saving the incoming data radio.read(&text, sizeof(text)); //Reading the data radio.read(&button_state, sizeof(button_state)); //Reading the data if(button_state == HIGH) { digitalWrite(6, HIGH); Serial.println(text); } else { digitalWrite(6, LOW); Serial.println(text);} } delay(5); }