We Used:
- BBC micro:bit.
- USB Cable.
- Feetech FS90R 360 degree continuous rotation micro servo.
- Microsoft MakeCode Editor.
Trim A Continuous Rotation Servo With Code:
The above image is of the underside of two continuous rotation servos, the screws that you can see are used to trim the servo. When a servo hasn't been trimmed it may start to rotate in one direction or the other when it is powered and receiving the signal telling it to stop, either 1.5ms or 90 degrees. Ordinarily, you would send the stop signal (1.5ms or 90 degrees) to the servo with a line of code and use a screwdriver to adjust the screw (trimpot) until the servo stops turning, but if your servo is buried inside a project this may be impossible, hence the need to trim it with code. We can do this easily by adjusting the 90 value by plus or minus one until we make the servo stop moving. In the example above, I went from 90 to 93 and determined that the effect was getting worse and not better so I went backwards from 90 to 83 and the servo stopped moving. Thus, whenever I want the servo to come to a full stop, the value will be 83 and not 90.The Kitronik Way:
Kitronik has created a number of custom servo control blocks to make it easier to create code for our products. The blocks are now a part of the MakeCode editor and can be added using the add package option. To the top of the editor is the Cog icon, when you click on this select Add Package from the menu and a dialogue box will appear. Type Kitronik into the space provided and press enter, choose the kitronik-servo-light box and our servo control blocks will be added to the menu. The Stop block above does exactly what it says on the tin. Regardless of whether your servo is trimmed or not this block will stop it. Rather than sending a pulse of 1.5ms or an angle of 90 the Stop block actually disconnects the PWM. No PWM signal=no movement.©Kitronik Ltd – You may print this page & link to it, but must not copy the page or part thereof without Kitronik's prior written consent.