Goals

  • Get to know the Octopus LED, normal LED, Crash sensor and OLED. 
  • Make something with different types of LEDs
  • Make something with Crash sensor and OLED
MATERIALS:
1 x BBC micro:bit
1 x Micro USB cable
1 x Breakout board
1 x Octopus LED
1 x Crash Sensor
1 x OLED
1 x LED
2 x Female-Female jumper wires

  • In this project, we are going to create a simple alarm machine which will alert the owner if someone has stolen his  or her property
  • The red LED will blink when the crash sensor detects that the object has been taken away
  • Else, the green LED will light up continuously
  • A message will always be displaying on the OLED, showing the status of the property

Note: You can use any jumper wire colour

  • Connect 2 Female-Female jumper wires to the LED.
  • The longer pin on the LED will connect to the yellow pin on the breakout board, while the shorter one connects to the black pin.
  • Plug the other end of the jumper wires to Pin 1
  • Connect the USB cable to the micro:bit and then to the breakout board as shown in the picture
  • For the next 2 components, make sure the colour of the wire follows the coloured pins on the break out board
  • Plug in the crash sensor to Pin 0
  • Plug in the Octopus LED to Pin 8
  • Lastly, plug in the OLED as shown in the picture
  • You are able to plug it into any of the three rows
  • 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

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

  • After that, use blocks under the Tinkercademy section to initialize the OLED and Crash Sensor as shown in the picture

  • Click on the section Variables and create a variable called “message”
  • This variable is used to contain different messages which will be displayed under different circumstances
  • This part of the code allows the red LED to blink continously
  • You can adjust the speed of blinking by changing the pause period
  • Since there are only two conditions, we need only one ‘else-if’ statement
  • When the Crash Sensor is pressed, the green Octopus LED will light up. Else if no force is applied to the Crash Sensor, the red LED will blink continuously.

  • Finally! You have created a simple alarm machine.