You can plug up to four servos in the Servo block of Crickit. The pin spacing is just right for servo connections.
At left are the connections for the Circuit Playground Express and Crickit combination.
And here is the Crickit for micro:bit (the micro:bit plugs into the Crickit but is not shown for clarity).
The servo connections are identical to the other Crickits.
Servos are so easy to use, you can control four independent servos - micro, mini, standard, metal gear or continuous rotation. Basically, if it has a 3-pin plug on the end and has 'servo' in the name, it'll work just fine.
Let's start with a simple demo that moves two servos back and forth:
Controlling servos is basically the same through a Crickit as through MakeCode directly.
There's two blocks you can use, one for setting the angle and one for setting the pulse width directly
We recommend using the angle block, its easier! Select which servo you want to use, from 1 through 4
Then adjust the angle. Remember it does take a little time for the servo motor to move, so you can't just set it back and forth instantly, try adding a delay of a second after moving to make sure it got to the angle you want!
Although the angles range from 0 to 180, servos may have different ranges depending on the make and model. Also, each servo is a little different, so you may not get precisely the same angle even if its the same servo! Tweaking/adjusting the angle may be necessary.
To stop a continuous servo from running you have to set the speed around 0 or set its angle to around 90 degrees with Crickit set servo .. angle to ..
(exact speed and angle is individual for each servo).
Precise Pulses
For advanced use, you can hand-tune the pulse width. The 'standard' for servos is that 0 degrees is 1000 microseconds (us), 90 degrees is 1500 and 180 degrees is 2000 us. But...like we said, it can vary. You may want to try values as low as 750us and as high as 2500us! Just go slow, changing the values only 100us at a time, so you dont thwack the servo gears too far, they could be damaged if they push too far! For that reason, we recommend using angles only until you're comfy with servo usage
Text editor powered by tinymce.