Microbit Sensors & Circuits
Intermediate
60 mins
165 points
What you need:
  • Microbit
  • LED Strip with crocodile clips

Shooting Stars

Embark on a fun coding journey where you'll create a new Microbit project, add the neopixel extension, and set up an LED strip. You'll learn to create a 'star' that lights up with a loud sound, test it on your strip, and make it 'shoot'. Add a splash of colour to your stars and download your code to see different coloured 'stars' shooting along the strip.

1 - Create a new Microbit project

To get started create a new Microbit project.

makecode.microbit.org

2 - Add the neopixel extension

To access the blocks we need to program the LED strip, you need to add the neopixel extension to your project.


3 - Setup the LED Strip

To be able to interact and program the LED strip we will need a variable that stores the strip.

Add the following code to your project. We set the value to be 30 as there are 30 LEDs on the strip.

4 - Create the star

We're going to use the microphone in the microbit to detect when there's a loud sound. When it detects a loud sound we will light up the first LED on the strip white.

We put the strip show block inside the forever block so that the strip is constantly being updated, this will be important later.

Add the following code to your project.

5 - Test it on your strip

Download the code onto your microbit and connect your LED strip to it using the crocodile clips.

Test that it works by clapping your hands near the microbit, the first LED should light up white.



Join our club 😃

To view the remaining 3 steps and access hundreds of other coding projects please login or create an account.

Copyright Notice
This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.
🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more