Using a micro servo (SG90)

Currently working on a project that involves using the <Servo.h> library. However, I noticed when I servo.write(0), it is at a position that is 90° from the current state. Can anyone help explain how to have it fixed? Thank you.

0 degrees is fully to one side, it's a position, not an relative movement.

If I recall correctly, the default position for an attach is 90 degrees which is the middle, which explains why it moved by 90 when you sent it to 0.

Not really sure what you want to have "fixed".

Okay that makes sense. Is there any way to make it almost precisely 90° or not when I move it. I have my min and max set to 500 and 2400. However, I don't know if its the micro servo itself to where you can't precisely get it to the point you want or simply changing the max and mins.

You can get more resolution of movement (if the servo will do it) by using writeMicroseconds() instead of write()

Fwiw, you can also determine the startup position by doing a write before the attach. (But of course it will jump to that position of that's not where it was when last shut down.)

Okay thank you for the pointers and help.

Thank you for that. Appreciate it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.