Contrôler des servomoteur a distance

bonsoir a tous, depuis longtemps je voulait faire un avion télécommander. il y a de ça un mois j'en ai eu l'occasion donc j'ai commencer a le faire. mais je rencontre un problème : pour le projet je le fait avec un module Radio (FS1000A) le teste a distance fonctionne mais j'ai un soucis, je n'arrive a contrôler deux servomoteur (pour les ailerons) a distance, il me dit que la bibliothèque "servo" n'est pas compatible avec "Radiohead" ou "VirtualWire" j'ai donc essayer sans bibliothèque mais je n'y parvient pas... si quelqu’un serait m'aider pour pouvoir contrôler mes servomoteur a distance je suis preneur.
voici le code pour l'émetteur :

#include <SPI.h>

const int upButton = 2;
const int downButton = 3;
const int leftButton = 4;
const int rightButton = 5;
const int motorSwitch = 8;
const int headlightSwitch = 12;

RH_ASK rf_driver;

void setup() {
  rf_driver.init();
  pinMode(upButton, INPUT_PULLUP);
  pinMode(downButton, INPUT_PULLUP);
  pinMode(leftButton, INPUT_PULLUP);
  pinMode(rightButton, INPUT_PULLUP);
  pinMode(motorSwitch, INPUT_PULLUP);
  pinMode(headlightSwitch, INPUT_PULLUP);
}

void loop() {
  uint8_t controlData = 0;

  if (digitalRead(upButton) == LOW) {
    controlData |= 0x01;
  }
  if (digitalRead(downButton) == LOW) {
    controlData |= 0x02;
  }
  if (digitalRead(leftButton) == LOW) {
    controlData |= 0x04;
  }
  if (digitalRead(rightButton) == LOW) {
    controlData |= 0x08;
  }
  if (digitalRead(motorSwitch) == LOW) {
    controlData |= 0x10;
  }
  if (digitalRead(headlightSwitch) == LOW) {
    controlData |= 0x20;
  }

  rf_driver.send(&controlData, sizeof(controlData));
  rf_driver.waitPacketSent();
  delay(100);
}

et le code pour le reçepteur :

#include <Adafruit_NeoPixel.h>
#include <RH_ASK.h>
#include <SPI.h>

#define LED_PIN 6
#define NUMPIXELS 19
#define RELAY_PIN 11
#define HEADLIGHT_PIN 13

Servo servoY;
Servo servoX;
Adafruit_NeoPixel pixels(NUMPIXELS, LED_PIN, NEO_GRB + NEO_KHZ800);
RH_ASK rf_driver;

void setup() {
  Serial.begin(9600);
  rf_driver.init();
  
  servoY.attach(9);
  servoX.attach(10);
  servoY.write(90);
  servoX.write(90);
  
  pixels.begin();
  pixels.show();
  
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(HEADLIGHT_PIN, OUTPUT);
}

void loop() {
  if (rf_driver.available()) {
    uint8_t buf[1];
    uint8_t buflen = sizeof(buf);

    if (rf_driver.recv(buf, &buflen)) {
      uint8_t controlData = buf[0];
      handleControls(controlData);
    }
  }

  static unsigned long previousMillis = 0;
  static unsigned long ledOffMillis = 0;
  const long interval = 500;
  const long offInterval = 1000;
  static bool toggleState = false;
  static bool ledsOn = true;

  unsigned long currentMillis = millis();

  if (digitalRead(HEADLIGHT_PIN) == HIGH) {
    if (ledsOn && (currentMillis - previousMillis >= interval)) {
      previousMillis = currentMillis;
      ledsOn = false;
      ledOffMillis = currentMillis;
      pixels.setPixelColor(17, 0);
      pixels.setPixelColor(18, 0);
      pixels.show();
    } else if (!ledsOn && (currentMillis - ledOffMillis >= offInterval)) {
      previousMillis = currentMillis;
      ledsOn = true;
      toggleState = !toggleState;
      if (toggleState) {
        pixels.setPixelColor(17, pixels.Color(255, 0, 0));
        pixels.setPixelColor(18, pixels.Color(0, 255, 0));
      } else {
        pixels.setPixelColor(17, pixels.Color(0, 255, 0));
        pixels.setPixelColor(18, pixels.Color(255, 0, 0));
      }
      pixels.show();
    }
  }
}

void handleControls(uint8_t controlData) {
  if (controlData & 0x01) {
    servoY.write(servoY.read() + 45);
  } else if (controlData & 0x02) {
    servoY.write(servoY.read() - 45);
  } else {
    servoY.write(90);
  }

  if (controlData & 0x04) {
    servoX.write(servoX.read() - 45);
  } else if (controlData & 0x08) {
    servoX.write(servoX.read() + 45);
  } else {
    servoX.write(90);
  }

  if (controlData & 0x10) {
    digitalWrite(RELAY_PIN, HIGH);
    for (int i = 0; i < 17; i++) {
      int redValue = random(100, 255);
      int orangeValue = random(20, 50);
      pixels.setPixelColor(i, pixels.Color(redValue, orangeValue, 0));
    }
    pixels.show();
  } else {
    digitalWrite(RELAY_PIN, LOW);
    for (int i = 0; i < 17; i++) {
      pixels.setPixelColor(i, 0);
    }
    pixels.show();
  }

  if (controlData & 0x20) {
    digitalWrite(HEADLIGHT_PIN, HIGH);
  } else {
    digitalWrite(HEADLIGHT_PIN, LOW);
    pixels.setPixelColor(17, 0);
    pixels.setPixelColor(18, 0);
    pixels.show();
  }
}

saisissez ou collez du code ici

saisissez ou collez du code ici

saisissez ou collez du code ici

saisissez ou collez du code ici

:warning:
Post mis dans la mauvaise section, on parle anglais dans les forums généraux. déplacé vers le forum francophone.

Merci de prendre en compte les recommandations listées dans Les bonnes pratiques du Forum Francophone