Create a fish feeding machine! Two red buttons on ADKeyboard will control the movement of the servo, and a message will always be displaying on the OLED, showing the status of the servo.
- 1 x BBC micro:bit
- 1 x Micro USB cable
- 1 x Breakout board
- 1 x ADKeyboard
- 1 x OLED
- 1 x Servo
- 8 x Wires (Optional)
Connect the USB cable to the micro:bit and then the micro:bit to the breakout board.
1x Breakout board
1x Micro USB cable
Plug in the ADKeyboard to Pin0 and the servo to Pin1. Make sure the colour of the wire follows the coloured pins on the breakout board!
1x Breakout board
Only the two red buttons (button A and button B) on ADKeyboard are used in this project.
We first need to add a package of code to be able to use our kit components.
This will open up a dialog box. Copy and paste this link into the Add Package… text field:
Select the search icon or press enter, then select the Tinkercademy button.
Note: If you get a warning telling you some packages will be removed because of incompatibility issues, either follow the prompts or create a new project in the Projects file menu.
Click on Tinkercademy inside the Code Drawer to find our custom blocks for the various components in your kit.
Always initialize the OLED at the beginning. Set the height and width to 64 and 128, the dimensions of the OLED.
Since there are only two conditions, we need only one ‘else-if’ statement.
When the button A of the ADKeyboard is pressed, the servo will turn to angle 70 and the OLED will display a message. Else if button B of the ADKeyboard is pressed, the servo will turn to angle 20 and the OLED will display another message.
You can adjust the servo angle as needed.
Finally! You have created a fish feeding machine!