Zoom! Cricket is a great motor driver platform and with MakeCode, it's super easy to use. Just connect to the Crickit Motor block.
The Crickit with Circuit Playground Express is shown first at left.
Note the GND terminal is not usually used with motors.
And using motors with micro:bit is just as easy.
Note: the micro:bit is not shown in the diagram at left for clarity, you'll need to plug one into the Crickit slot to have everything work.
You can drive two separate DC motors, so lets go ahead and get right to it!
DC motors are controlled by 4 PWM (adjustable speed) output pins, the 4 pins let you control speed and direction. And we'll use our CRICKIT Motors block set to help us manage the speed and direction for us, making it very easy to control motors
Note that each DC motor is a little different, so just because you have two at the same speed does not mean they'll rotate at the exact same speed! Some tweaking may be required
Here's an example program that will move a single motor in different speeds and directions
Setting Motor Speed
You can set the speed of the motor from 0% to 100% with this block. You can select which motor to use, 1 or 2. Once you set the speed of the motor it will continue at that speed until you change it or ask it to stop.
You can change direction by having a negative percentage speed!
You may want to have two motors move at the same time so they act like wheels on a car. In that case, you can use this handy block that will control two motors at once!
You can set the two speeds at once. If both move at the same positive speed, the tank/car will move forward. Same negative speed it will move backward. If one side moves faster than the other, the car will turn.
If you want to 'invert' the motor, it will flip which direction positive/negative numbers go. That is, if positive was forward, now positive will mean backwards
This is sometimes handy if you want to use only positive numbers or to keep your code looking tidy.
Page last edited March 08, 2024
Text editor powered by tinymce.