Introduction
Connect an LED to a Bit Board and control it with a micro:bit
We'll make the LED fade from off to one quarter brightness using a loop.
Video Overview
Featured Document
-
-
We'll use Maker Tape to connect the LED to the Bit Board on a LEGO baseplate.
-
Connect the Negative (-) side of the LED to a Ground (GND) hole on the Bit Board.
-
Connect the Positive (+) side of the LED to Pin 8 on the Bit Board.
-
You'll notice the Ground on the Bit Board (as well as the LED and other Crazy Circuits components we'll use) is color coded White.
-
-
-
If you've never used a micro:bit before you'll want to check out this guide: Bit Board V2 Setup and Use
-
We're going to load the following code for our LED Fade Loop program: https://makecode.microbit.org/_ePaF4fYHr...
-
This code will make the LED gradually get brighter waiting a 5 milliseconds between each step. We'll use a for loop to do this.
-
We'll us the analog write command but instead of typing in a number we'll use a variable that changes with each iteration of the loop.
-
Our loop will save us a lot of typing since we don't have to add 256 analog write commands all with a different number.
-
We've also added the pause command because the micro:bit can run so fast that without you might not even see the LED slowly fade up from 0 to 256.
-
-
-
Once the code is loaded it should start running immediately.
-
You can power the micro:bit via the USB cable you used to load the code or you can use a battery pack plugged into the Bit Board.
-
The LED should start off then get gradually brighter in smooth steps.
-
-
-
Follow along with our recorded Live Stream!
-
You can watch the full video of us walking through this project, along with explaining and exploring the code: https://youtube.com/live/z8ONp1Q9ZV0
-
