Elecfreaks gravatar image

Posted 2017-09-04 12:34:22 +0200

blogs->all

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

    No tags

Introduction:

LED has wide applications. We can see most signal lights we saw in our daily life use LED as its major illuminate component. 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 Micro 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 have bought Elecfreaks Micro: bit Starter kit, it will conclude all of the above components.

Software:

Microsoft Makecode online Editor

Major Component Introduction

Micro: bit Breadboard Adapter

Micro: bit Breadboard Adapter can extend all footers of Micro: bit to breadboard so that we can create Micro: bit circuit on breadboard easily.

image description

This is Micro: bit Breadboard Adapter. It can be suitable to all kinds of breadboards.

image description

LED

LED is abbreviated from Light Emitting Diode. It is a kind of semi-conductor diode. It can transfer electric to light. And if there is current flow, it can emit light. image description image description

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 limiting current. It can limit the current of the circuit connected. And in our experiment, we use 100Ω resistance. If there is no current limit, LED will be ruined.

image description

If you want to know resistance value by color circles, you can refer to this article: How to Identify Color Circle Resistance Value.

Hardware Connection

You can complete hardware connection according to the picture below:

image description

After connection, you will see:

image description

Programming

Open Microsoft Makecode, coding like the picture showed below on editor interface.

image description

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.

https://makecode.microbit.org/#pub:_aPtRppeup0E5

Code Explanation:

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.

Pause

If 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 LED flashing alternatively. If you do not get this result, go back and check your operations.

1

Question:

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.

1 comments

Elecfreaks gravatar image

Posted Sept. 4, 2017, 12:37 p.m.

View this Course from: https://www.elecfreaks.com/9784.html

Sign in to comment.

User menu

    or sign up

Recent questions

Related posts by tag

No results