The Servo is a great component to use to get some movement into your projects, and it’s good step into the world of robotics.
A Servo is easy to attach to your Crumble. It needs to be connected to +, –, either from the battery or the Crumble and then an output pad on the Crumble (A, B, C or D). It is useful to use a Crumbliser as it makes crocodile clip connections much easier!
Note: Don’t forget you will need to add batteries.
This is the block that controls the servo. Click the letter or the angle to edit. The angle can be set between -90 and 90 degrees. This is relative to the servo’s position.
This block of code moves the servo to 90 degrees, waits one second, moves it to 0 degrees, waits another second and then moves it to -90 degrees. It then waits one more second before repeating.
Note: Prior to version 1.0.13, the servo only holds its position whilst the program is running – it stops when the program ends. Use wait statements or a do forever loop to keep it holding its position.
Here is the servo working using the previous code.