Software apps and online services
The micro:bit (also referred to as BBC micro:bit, stylized as micro:bit) is an ARM-based embedded system designed by the BBC for use in computer education in the UK.
The board is 4 cm × 5 cm and has an ARM Cortex-M0 processor, accelerometer and magnetometer sensors, Bluetooth and USB connectivity, a display consisting of 25 LEDs, two programmable buttons, and can be powered by either USB or an external battery pack. The device inputs and outputs are through five ring connectors that are part of the 23-pin edge connector. We can do pretty cool stuff with this micro bit and I am going to show you one.
- Micro:bit (1 pcs)
- USB cable (1 pcs)
- Battery AAA 1.5V (2 pcs)
- Battery Box (1 pcs)
So let's test our micro:bit before programming it. There are two ways to test your micro:bit.
1. via USB cable: You can test your micro:bit just to see if it is working fine or not. To do so connect your micro:bit to your computer via USB cable and wait for a second your micro:bit will display "HELLO" by blinking LEDs. If it does, then it is working fine.
2. via Battery Connector: Insert batteries into battery box and connect your micro:bit via power pins and then see if it's displaying "HELLO". If it does, then it is working fine.
So now let's move to coding. Let us see how we can code and display "Hello" manually. Below are some steps to follow.
1. Go to Makecode.com:
Microsoft MakeCode is actually a platform that allows us to code for a micro:bit, and also provides an interactive simulator where we can debug and run our code, and will be able to see what to expect out right there on the site.
Go to MakeCode and choose Micro:bit and click on code.
After this, you will see the following screen. As we can see that there is one micro:bit simulator, which will show the output instantly when we will finish writing our code.
Let's get started and display "HELLO" on our micro:bit. To do so, you just need to go to basic and scroll down to see an onStart block. Now drag and drop, and again go to basic and search for the show string <hello> block. That's all; now you will see HELLO on your simulator.
After completing this step micro:bit will restart itself and run the code. It will display "HELLO" there on the simulator. Quite easy? Yeah, quite easy. So let's move on and code for the rest.
To display a rectangle on a micro:bit. Go to basic and find forever block and drag and drop it. Again you go to basic and drag show LED block, and turn on all the LEDs you want. For me, it is square/rectangle. That's all, and it will display rectangle/square on the micro:bit.
For the button pressed event, go to input and drag button A is pressed block out and insert one showString block inside it. Then customize the text you want to display when button A is pressed. For me, it is MICRO.
Same goes for button B pressed and customize the text. Here is the sample.
That's all for the coding part.
Now let us see how to run our code on the actual Micro:bit.
- Plug in the Micro:bit to a computer via USB.
- After plugging in, you should see HELLO on your Micro:bit by default.
Go to your computer or press Windows +E (PC). For Linux, go to files and you will see MICROBIT Drive there.
- Now go to Makecode.com and download your program that you have written there.
- Now go to your download folder and copy the downloaded Hex file in MICRO bit Drive.
- Now wait for a second for Micro:bit to restart, and it will start displaying output automatically.