#include <SoftwareSerial.h>
#include <Servo.h>
Servo myservo1;
Servo myservo2;
int potpin = A8;
int val1;
int val2;
void setup()
{
Serial.begin(9600);
Serial1.begin(4800);
myservo1.attach(39);
myservo2.attach(41);
}
void loop()
{
val1 = analogRead(potpin);
val2 = analogRead(potpin);
val1 = map(val1, 0, 1023, 0, 180);
val2 = map(val2, 0, 1023, 180, 0);
myservo1.write(val1);
myservo2.write(val2);
delay(15);
}
Voici mon programme arduino pour contrôler deux servo moteurs a distance grace a des TDL2A sur une carte arduino méga avec la librairie software serial.
Je voudrais savoir si mon programme fonctionne et si ce n'est pas le cas, comment je pourrais l'améliorer.
Merci d'avance !