J’ai réussi a faire quelque chose qui marche pas trop mal de val a val1 en vitesse réglable sur val2 mais de val1 a val il va trop vite
J’arrive pas a trouver la solution
Le code
#include
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
int potpin = A0;// de 0 à 90
int val;
int potpin1 = A1; // de 90 à 180
int val1;
int potpin2 = A2;// tempo de 10 à 100
int val2;
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
for (pos = val; pos <= val1; pos +=1) { // goes from val degrees to val1 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(val2); // waits val2 for the servo to reach the position
val2 = analogRead(potpin2);
val2 = map(val2, 0, 1023, 0, 100);
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 90 ); // scale it to use it with the servo (value between 0 and 90)
val1 = analogRead(potpin1); // reads the value of the potentiometer (value between 0 and 1023)
val1 = map(val1, 0, 1023, 90, 180); // scale it to use it with the servo (value between 0 and 90)
}
}