Skip to content
02micro:bit ยท MakeCode 25 minutes

A/B counter

Count up with A, down with B, and reset with both together.

A/B counter project
Illustration of the finished idea. Build from the diagram and connection table, not the photo.

Lesson goal: Store a number in a variable, change it from button events and show it on the display.

Open MakeCode

Section 1

Understand

  • variable
  • change by
  • event handlers
  • show number
  • A+B event
  • 1A variable stores the count.
  • 2Button A adds one, button B takes one away.
  • 3Each press is an event that runs its own blocks.

Safety first

  • No wiring.