+21622886281
LED Micro:bit

Control the lighting of a LED using the Micro:bit buttons

Purpose of this tutorial:

In this tutorial we will control the lighting of an LED via the two buttons A and B of the micro: bit card:

1- When you press button A, the LED lights up

2- When you press button B, the LED goes out.

Mounting

As for the assembly, it is easy to connect LEDs to the micro: bit either by using alligator clips or a micro-bit breadboard adapter.

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

As for the assembly, it is easy to connect LEDs to the micro: bit either by using alligator clips or a micro-bit breadboard adapter. We connect the Po pin of the micro-bit card to the resistor, then the anode (+ terminal) of the LED and the cathode (- terminal) of the GND of the micro: bit card.

There are many mounting methods and here are some examples:

Makecode Program

Here is the makecode program which controls the lighting of an LED connected to Pin 0 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