what is BBC micro: bit?
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. and we can do pretty cool stuff with this micro bit and I am going to show you one.
Picture Source: -MIcrobit developer community
2.usb cable (1 pcs)
3.Battery AAA 1.5V(2 pcs)
4. Battery Box (1 pcs)
so let’s test our micro: bit before programming it. so 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 displaying “HELLO”.if it does then it is working fine.
So now let’s move to coding part.let us see how we can code and display Hello manually. Below are some Steps to follow.
Microsoft make code is actually a platform that allows us to code for a micro bit and also provides an interactive simulator where we can debug and can run our code and will be able to see expected out right there on the site.
go to make code 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.
so 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.and it will display HELLO there on the simulator. quite easy? yeah quite easy. so let’s move on and code for the rest.
so to display a rectangle on a micro bit. Go to Basic and find see forever block and drag and drop it. gain 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.
so that’s All for coding part.
Now let us see How to Run our code on Actual Microbit .follow these Steps.
1. plug in the Micro bit to a computer via USB.
2.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.
3.Now go to Makecode.com and download your program that you have written there.
4. Now go to your download folder and copy the downloaded Hex file in MICRO bit Drive.
Now wait for a Second Micro bit Restart and it will Start Displaying output automatically. That’s All.
output Demo is Here:-