Bonjour,
J'ai un souci concernant la bibliothèque servotimer2
Car quand j'utilise celle-ci mon moteur ESC ne s’arrête pas immédiatement.
Cependant quand j'utilise la bibliothèque servo le moteur s’arrête immédiatement
Auriez vous une idée ?
const int SW_pin = 2; // digital pin connected to switch output
const int X_pin = 0; // analog pin connected to X output
const int Y_pin = 1; // analog pin connected to Y output
#include <ServoTimer2.h>
#define rollPin 8
#define pitchPin 9
ServoTimer2 GOUV;
ServoTimer2 ESC;
int potValue;
int gouvernail;
void setup() {
pinMode(SW_pin, INPUT);
digitalWrite(SW_pin, HIGH);
Serial.begin(9600);
gouvernail = 0;
GOUV.attach(rollPin); // attach a pin to the servos and they will start pulsing
ESC.attach(pitchPin);
}
void loop() {
potValue = analogRead(Y_pin);
potValue = map(potValue, 524, 1023, 751, 2250); // scale it to use it with the servo library (value between 0 and 180)
//erial.println(potValue);
ESC.write(potValue); // Send the signal to the ESC
gouvernail = map(analogRead(X_pin), 0, 1023, 750, 2250);
GOUV.write(gouvernail);
Serial.println(gouvernail);
delay(50);
}