Skip to content

Gweithgaredd

Water bottle alert

Dechreuwr | MakeCode, Python | Mesurydd cyflymiad | Iechyd

Cam 1: Gwneud

Beth yw e?

Turn your BBC micro:bit into a water bottle alert, so you can tell if someone else has drunk from it. You will learn how to use the micro:bit's LED display and accelerometer.

Mae'r ddau fideo hyn yn dangos i chi yr hyn y byddwch yn ei greu a sut i'w godio:

Sut mae'n gweithio

  • The micro:bit shows a heart on its LED display when your water bottle is upright.
  • The LED display shows a warning cross when a tilt is detected by the micro:bit’s accelerometer. The cross stays there until you reset the program by pressing the reset button on the back of the micro:bit or by disconnecting and reconnecting the battery.
  • An accelerometer measures forces in three dimensions, including gravity, so your projects can tell which way up your micro:bit is.

Beth sydd ei angen arnoch

  • micro:bit (neu efelychwr MakeCode)
  • Golygydd MakeCode
  • pecyn batri
  • our set-up guide may be useful

Cam 2: Codio

Cam 3: Gwella

  • Find a way to reset the program without using the micro:bit’s reset button, for example by pressing button A or B to show a heart icon.
  • Add an audible alarm using blocks from the music section of the MakeCode editor.