MakeCode For Continuous DC Motors
With Crickit support in MakeCode, you should have a green CRICKIT block group available. Clicking on that group pops out various blocks for Crickit capabilities including those related to motor control as shown below.
Drag the crickit run motor
block into the Forever
loop
- Adjust the speed by changing the percentage.
- Motor will run forever.
- If the motor is going the wrong way, use a negative percentage.
Stop and Start using Circuit Playground Buttons
You can use the on button click
event blocks to make quick interactive motor movements:
In this example above, one button makes the motor run. The other button will make the motor stop.
Using the Circuit Playground Slide Switch to Change Motor Direction
The set motor inverted
block changes the motor direction without having to swap wires. Add the following blocks to utilize the slide switch to change the motor direction.
Page last edited March 08, 2024
Text editor powered by tinymce.