Let’s Explore
What is micro:bit?
The BBC micro:bit is a pocket-sized computer that introduces you to how software and hardware work together. It has an LED light display, buttons, sensors and many input/output features that, when programmed, let it interact with you and your world.
25 LED Lights USB Connector 2 Buttons Pins Reset Button Battery Socket Processor & temperature Radio Compass, Accelerometer & Pins
Button A Button B
Your BBC micro:bit has a wide range of features for you to explore-
1. Buttons: The micro:bit has two buttons on the front that can be used separately or together to make things happen.
2. LED display & light sensor:
25 LEDs arranged in a 5x5 grid make up the display for showing pictures, words and numbers. They can also act as sensors, measuring how much light is falling on your micro:bit.
3. Pins - GPIO
The GPIO pins allow you to connect headphones, sense touch and add other electronics to expand the possibilities of your micro:bit. The new micro:bit has indentations to grip crocodile clips more securely.
GPIO Pins
Pin - 3 volt power You can power external LEDs and other electronics using the 3 volt power pin. 3 Volt Power
4.
5.
- Ground
the ground or Earth pin
used to complete electrical circuits when you connect headphones, LEDs or external switches to your micro:bit.
Pin
The GND pin is
- it's
Ground Pin
Features on the Back 1. Radio & Bluetooth antenna 2. Processor & temperature sensor 3. Compass 4. Accelerometer 5. Pins 6. Micro USB socket 7. Single yellow LED 8. Reset button 9. Battery socket 10. USB interface chip
What is Scratch?
Scratch is a visual programming language platform developed by the MIT Media Lab in 2007. Its drag-and-drop interface with colorful blocks makes it one of the most intuitive programming languages to learn. It teaches you all the basics of programming concepts like variable, loops, conditional statements in a very easy way.
Scratch Platform: There are the following five main elements of Scratch and they are: 1. Programming Palette 2. Stage Area 3. Sprites 4. Script 5. Script Area
Platform Overview
Connecting Scratch with Microbit You Will Need: ● BBC micro:bit. ● A microbit powering method such as a USB Cable. ● A computer with an internet connection and Bluetooth enabled. ● A modern browser such as Chrome/Safari.
below is a step by step guide for getting started with Scratch for the microbit. Step One - Join Scratch: go to your chrome browser and search for Scratch and then click on get Started.
Detailed
Step
2: Setting up your Account:
Setting up an account opens up all of the features that Scratch has to offer. If you want to save your work online and be able to share it with others, then an account is essential. Just click on the Join button on the homepage and the dialogue box shown above will open. The information required is;
● Username and password.
● Age, gender, and country.
● Email address.
Step 3: Install Scratch Link In order to enable communication between Scratch and the microbit, you will need to install their Scratch Link on your computer or device. ● Download the Scratch micro bit hex file. ● Go to https://scratch.mit.edu/microbit , select the OS Accordingly and download Scratch Link.
Step
3: Install Scratch Link
● Plug your micro bit into your computer via USB. The microbit should now show up as a removable drive in Windows. Drop the file you downloaded onto the microbit removable drive.
● The HEX file that you place on your micro bit makes it possible for the Scratch editor to automatically flash your code to the microbit as you work.
Adding microbit Extension To The Editor:
In the bottom left of the Scratch editor, is the add extension button. Click on this button and select the micro:bit tile. It will now check that Scratch Link is running and that Bluetooth has been enabled. It will then list the micro:bit, click on the microbit and you will be taken back to the editor that now has the microbit blocks added.
Adding Extension for microbit
Click On Micro:Bit Extension
NoteIf you don't have a microbit connected and Scratch Link running, the dialogue box will tell you. If you close the dialogue, you will still be able to write code using the newly added microbit support.
In order to flash a program over to the microbit Bluetooth on your computer needs to be active and the Scratch Link software needs to be running. I have Scratch Link added to my Windows taskbar to make it easy to start up when I need it.
Microbit
Blocks Once you successfully added the microbit extension and paired the microbit with scratch then you are ready all the blocks provided by the scratch platform as shown.
Let's Create Some Code
Let's have a go at making a program that demonstrates how Scratch and the microbit can work together to deliver a Scratch style 'Hello World' outcome!
Adding Sprite : Most of the sprites in the Scratch Library have multiple costumes to aid in animation. Some sprites will have costumes that break up walking,dancing, or waving, and other activities. You can see from the above code that we selected a specific costume in which the dinosaur's mouth was wide open.
Let’s Code
The sprite we chose from the library then appears in a random location on the screen and says "Hello World". Three seconds later, the sprite disappears and won't reappear until the A button on the microbit is pressed.
What’s Going On:
● When the A button on the microbit is pressed the code below is executed in sequential order.
● A specific costume is chosen for our sprite.
● The sprite is moved to a random location on the screen.
● If the sprite goes over the boundary of the edge of the screen, it is bounced back so it is fully on screen.
● The sprite is made visible.
● Our Hello World message is displayed in a speech bubble. (usually from the mouth, unless after a bounce in which case all bets are off)
● The message is displayed for 3 seconds.
● The sprite is hidden from view.
● Pressing the A button on the microbit will start the process again.
Transferring Code To The microbit
● Any code that you write for the microbit is automatically flashed over Bluetooth to the microbit.
● Any changes and tweaks you make will also be automatically flashed.
● You can test this for yourself. As soon as you've produced the code press the A button on your micro bit and you will see it played out in the test area.