Micro:bit Experiment 01: LED Scroller —???Elecfreaks Micro:bit Starter Kit Course

Micro:bit Experiment 01: LED Scroller —???Elecfreaks Micro:bit Starter Kit Course

Introduction:

LED has wide applications. Most signal lights we saw in our daily life use LED as its major light source. In today’s experiment, we are going to use Micro:bit to make 2 LED beads twinkle alternatively.  

Components List:

Hardware:

1 x Micro:bit Board

1 x MicroB USB Cable

1 x Microbit Breadboard Adapter

1 x Transparent Breadboard - 83 * 55 mm

2 x LED

2 x 100 Ohm Resistors

1 x Breadborad jumper wire 65pcs pack

Tips: If you want all components above, you may need Elecfreaks Micro:bit Starter Kit. 

Software:

Microsoft Makecode Online Editor  

Major Components Introduction

Micro:bit Breadboard Adapter

Micro: bit Breadboard Adapter can extend all footers of Micro: bit to breadboard so that we can create circuit on breadboard easily. This is how Micro: bit Breadboard Adapter is plugged into breadboard. It can be suitable to all kinds of breadboards.

LED

LED is the abbreviation of Light Emitting Diode. It is a kind of semi-conductor diode. It can convert electricity into light. When current passes throught it, it will glow with light. If you look carefully at the LED you will notice two things. One is that the legs are of different lengths and also that on one side of the LED, instead of it being cylindrical, it is flattened. These are indicators to show you which leg is the Anode (Positive) and which is the Cathode (Negative). The longer leg gets connected to the Positive Supply (3.3v) and the leg with the flattened side goes to Ground.  

Resistance

Resistance is a component for current control. It can limit the current of the circuit connected. And in our experiment, we use 100???resistance. If there is no current limit, it will cause LED damage. Want to know resistance value by color circles? You can read this article: How to Identify Color Circle Resistance Value.  

Hardware Connection

  Connect your components according to the picture below: After connection, you will see:

Programming

  Click to open Microsoft Makecode, write the following code in the edit area.

You can see the whole program in the page below. Click “Edit” on the right top corner, and then “download”, you can download your code into Micro:bit.

(Embed Editor??? 

Code Explain:

Forever The forever block is a block that loops any other command blocks inserted into it over and over again…forever. It starts from the top and executes your code in order working its way to the bottom and then starts at the top again.  

Digital Write The DigitalWrite block enables you to turn a pin on or off. There is a dropdown option for which pin you want to control, and it accepts a variable as the pins state. You use 1 as on and 0 as off. If you prefer, you can also use Boolean states of true and false, but we will use 0 and 1 as our standard throughout this guide.  

PauseIf you were to just turn pins on and off with the digital write block without a pause, the LED would blink really, really fast. The pause block enables you to slow the micro:bit down and lets you control the timing of things happening. It accepts a number or variable as the number of milliseconds you want the micro:bit to pause. Think of this block as a stoplight for your code!  

Experiment Result

You can see 2 LEDs flashing alternatively. If it is not, go back and check your operations.

Think

If we want to control 4 LED beads and make it illuminate by turns, then how shall we design our circuit and make program. We would like to receive your further discussion with us. You can leave your comment below.

Relative Readings

Start Your Micro:bit Programming Trip ELECFREAKS Micro:bit Starter Kit Experiment 02:Button ELECFREAKS Micro:bit Starter Kit Experiment 03:Trimpot ELECFREAKS Micro:bit Starter Kit Experiment 04:Photocell ELECFREAKS Micro:bit Starter Kit Experiment 05:RGB LED ELECFREAKS Micro:bit Starter Kit Experiment 06:Self-lock Switch ELECFREAKS Micro:bit Starter Kit Experiment 07:Temperature Sensor ELECFREAKS Micro:bit Starter Kit Experiment 08:Servo ELECFREAKS Micro:bit Starter Kit Experiment 09:Buzzer ELECFREAKS Micro:bit Starter Kit Experiment 10:Motor ELECFREAKS Micro:bit Starter Kit Experiment 11:Rainbow ELECFREAKS Micro:bit Starter Kit Experiment 12:Accelerometer ELECFREAKS Micro:bit Starter Kit Experiment 13:Compass ELECFREAKS Micro:bit Starter Kit Experiment 14:ambient light