Controlling Servo with CodeBit?

Hello,

I must be missing something, but if I have a CodeBit with a servo connected to Output 1, how do I tell the servo what position to go to? The only output option seems to be % (or on/off) and that isn’t really applicable to a servo.

Any help appreciate.

Thanks.

1 Like

Hi @michaeljornlin :smile:

littleBits servos work differently from other servos, because there is an attiny chip on board that helps control its movement.

Try setting the micro-switch on the servo to “turn” mode and control it with a dimmer module before it.

"In turn mode, you can control which direction the servo arms point. The servo listens to how much voltage you give it, and moves to the specific position. As you increase the voltage (electrical intensity), the arm turns clockwise; decreasing voltage turns the arm counter-clockwise.

If you use the simple circuit: power + dimmer + servo (turn mode), the servo arm will follow the turns of the dimmer knob." Tips & Tricks: Servo


(pic by @alexpikkert)

Now, still in turn mode, try using the servo with your CodeBit and %. How does that work for you?

P.S. If someone knows of a CodeBit sample project that uses the servo Bit, could you please reply with a link? :pray:

1 Like

Thank you for that information. It does move with percentage but the range of motion is maybe 45° at best. If I go beyond 25%, it starts to jump like it’s past it’s max. I have it go to 0% on loading.

1 Like

Interesting. How does the servo behave with just a dimmer? Can you share your code and a picture of your circuit when you use it with the CodeBit? Then friends can help troubleshoot.

@JackANDJude found this invention project that uses a code bit and a servo bit to make a fidget spinner! Mind blown! https://classroom.littlebits.com/projects/fidget-spinner-music-maker