Transformer un servomoteur sg90 180 degrés en servomoteur à rotation continue ?
Pour le servo 9g en rotation continue, j’ai suivi la vidéo ci-dessus. Vous trouverez un code de test en bas d’article.
Connexion a l’Arduino:
Brun -> GND
Rouge -> 5V
Jaune -> Pin 3
Servomoteur à rotation continue et Arduino
Code utilisé:
Source: LIEN - Juste parce que ça vaut le coup 🙂
/*
Controlling a servo position using a potentiometer (variable resistor)
by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
modified on 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Knob
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int val; // variable to read the value from the analog pin
void setup() {
myservo.attach(3); // attaches the servo on pin 9 to the servo object
}
void loop() {
val = 5; // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}




0 commentaires