+21622886281
LED Micro:bit

Control the lighting of two LEDs using the Micro:bit buttons

Purpose of this tutorial:

In this tutorial we will control the lighting of two LEDs (red and green) via the two buttons A and B of the micro: bit card:

1- When you press button A, the green LED turns on and the red LED turns off.

2- When you press button B, the red LED turns on and the green LED turns off.

Components required

  • micro: bit card
  • 1 red LED
  • 1 resistance of 220Ω Micro: bit
  • GPIO Expansion Board (for setups 2 and 3)
  • connecting wires 

Mounting

To perform the assembly, you can connect the green LED to pin P0 and the red LED to pin P1 of the micro: bit card.

There are many mounting methods and here are some examples:

Mounting (1)

Mounting (2)

Mounting (3)

Makecode Program

Here is the makecode program which allows you to light 2 LEDs:

  • Green LED connected to the P0 pin of the micro: bit.
  • Red LED connected to pin P1 of the micro: bit.



0 commentaire


Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top