Fish Feeder
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.
YOU WILL NEED
- 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)
STEP 1
Connect the USB cable to the micro:bit and then the micro:bit to the breakout board.
Materials
1x micro:bit
1x Breakout board
1x Micro USB cable
1x OLED
STEP 2
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!
Materials
1x Breakout board
1x ADKeyboard
1x Servo
STEP 3
Only the two red buttons (button A and button B) on ADKeyboard are used in this project.
STEP 4
We first need to add a package of code to be able to use our kit components.
STEP 5
This will open up a dialog box. Copy and paste this link into the Add Package… text field:
https://pxt.microbit.org/89153-37616-68542-51563
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.
STEP 6
Click on Tinkercademy inside the Code Drawer to find our custom blocks for the various components in your kit.
STEP 7
Always initialize the OLED at the beginning. Set the height and width to 64 and 128, the dimensions of the OLED.
STEP 8
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.
STEP 9
Finally! You have created a fish feeding machine!
Made this activity? Good Job! Now spread the word. Share a photo of your creation on social media with #letsgethacking #FishFeeder