Skip to content

Atividade

Alarme de inclinação

Iniciante | MakeCode, Python | Acelerômetro, Som, Tela de LED | Entrada/saída, Sensores

Passo 1: Projeto

O que é?

Make an alarm that lights up and plays a tune when your micro:bit is moved.

Estes dois vídeos mostram o que você fará e como fazer a programação:

Introdução

Coding guide

Como funciona

  • In this project you'll make an alarm that goes off when you move your micro:bit. You could hide it inside or place on top of something precious, or put it in a bag and use it as a reminder to check you have everything you need when you go out.
  • Your micro:bit contains an accelerometer which measures forces. The accelerometer detects a shake gesture and shows a pattern on the LED display.
  • It also plays a warning melody. To hear the melody, use the MakeCode simulator or attach headphones to pin 0 and GND. You can also use an amplified speaker.
  • Press the reset button on the back of your micro:bit to clear the screen and make it ready for using again.

O que você precisa

  • um micro:bit
  • MakeCode or Python online code editor
  • bateria
  • optional speaker and crocodile clips

Passo 2: É hora de programar

Passo 3: Vamos melhorar

  • Change the face icon to your own picture, using the 'show leds' block in MakeCode or the Image instruction in Python.
  • Replace the melody with your own creation or a tune you love.
  • Make it more sensitive using direct readings from the accelerometer instead of the shake gesture.