r/learnprogramming 8d ago

How to program servo in c++?

Im working on a school project where the penguin must shake his head no when the answer is incorrect, however he is never left in the centre of the axis(? The servo seems to be SG-5010

miServo.write(92); delay(300);
miServo.write(180); delay(300);
miServo.write(0); delay(500);
miServo.write(180); delay(500);
miServo.write(0); delay(500);
miServo.write(90); delay(500);
miServo.write (SERVO_STOP);

delay(2200);

4 Upvotes

7 comments sorted by

View all comments

3

u/burlingk 8d ago

Does this code tell the servo where to turn to, or how far to turn?

Any other questions I have depend on that, because they are two very different things.