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'll 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

Instructions

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

Instructions

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

Instructions

Only the two red buttons (button A and button B) on ADKeyboard are used in this project.




Materials


Step 4

Instructions

We first need to add a package of code to be able to use our kit components.




Materials


Step 5

Instructions

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.




Materials


Step 6

Instructions

Click on Tinkercademy inside the Code Drawer to find our custom blocks for the various components in your kit.




Materials


Step 7

Instructions

Always initialize the OLED at the beginning. Set the height and width to 64 and 128, the dimensions of the OLED.




Materials


Step 8

Instructions

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.




Materials


Step 9

Instructions

Finally! You have created a fish feeding machine!




Materials


Code and References

Completed this tutorial?

Spread the word! Let's get this trending on social media with #letsgethacking #FishFeeder