EasyManua.ls Logo

Sparkfun Electronics Inventor's Kit - Experiment 0: Hello, micro:bit!; Building the Hello World Animation

Sparkfun Electronics Inventor's Kit
83 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
The simulator will update as you build your code, and if you want to run it from the beginning you
can click the stop and run buttons to start it over again!
Speaking of code, let’s write a quick program and get it onto your micro:bit!
Experiment 0: Hello, micro:bit!
Introduction
“Hello World” is the term we use to define that first program you write in a programming language or
on a new piece of hardware. Essentially it is a simple piece of code that gives you a quick win
(fingers crossed) and a first step in learning. It also gives you a chance to make sure everything is
up and running and A-OK.
For your first “Hello World” we are going to create a simple animation on the LED array that repeats
forever. If you just want the complete program, you can see it here. To see a step-by-step
explanation of how we built the program, continue reading!
Note: You may need to disable your ad/pop-up blocker to interact with the MakeCode programming
environment and simulated circuit!
Building ‘Hello World’
A “Hello World” on the micro:bit is a little different than on a normal run-of-the-mill microcontroller.
The micro:bit has no single LED to blink on its own, as you would find on the Arduino or similar
boards. What the micro:bit does have is an LED array! So, the “Hello World” for the micro:bit is to
draw something using the LED array!
When you open MakeCode you are greeted with two blocks: the
OnStart
block and
the
forever
block. The
OnStart
block is all of your code that will execute at the very beginning of
your program and only run once. The
forever
block is code that will loop over and over
again…forever.