Goals

  • Get to know the ADKeyboard, OLED and servo
  • Make something with a servo
  • Make something with a OLED
MATERIALS:
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)
  • In this project, we are going to create a fish feeding machine
  • Two red buttons on ADKeyboard will control the movement of the servo
  • A message will always be displaying on the OLED, showing the status of the servo

  • Plug in the OLED as shown in the picture
  • You are able to plug it into any of the three rows
  • Connect the USB cable to the micro:bit and then to the breakout board
  • For the next 2 components, make sure the colour of the wire follows the coloured pins on the break out board
  • Plug in the ADKeyboard to Pin0
  • plug in the servo to Pin1

 

  • Only the two red buttons (button A and button B) on ADKeyboard are used in this project
  • Click on Advanced in the Code Drawer to see more code sections
  • We’ll add a package of code to be able to use our kit components
  • Look at the bottom of the Code Drawer for Add Package and click it
  • This will open up a dialog box
  • Copy and paste this link into the Add Package… text field: https://pxt.microbit.org/50544-64675-33322-24641
  • Click on the search icon  or press enter, then click on 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 begining
  • 64 and 128 represent the height and width 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 messge.
  • You can adjust the servo angle to suit the project.
  • Finally! You have created a fish feeding machine!