Adding a servo
Connecting a servo with alligator clips
You need:
- 1 standard servo
- 3 wires with an alligator clip on one end and a male jumper on the other end (in black, red, and orange/yellow)
To connect the servo:
- Plug the wires to the connector of the servo: black to brown, red to red, yellow to orange.
- Clip the wires to the pins of the Kniwwelino:
- The black one to the GND pin
- The red one to the 3.3V pin
- The yellow one to either D5, D6 or D7
Programming servos
You can program your servo with the following block.
Select the pin to which you connected your servo to (D5, D6 or D7), and set the angle to which you seek to rotate the servo. The range here needs to be between 0 and 180.
For example, to set the servo on three different positions (0; 90; 180) depending on which button was clicked, you could use the following code: