BBC micro:bit – Let’s get started

Let’s get started

Attach USB cable to the top of micro:bit and plug in laptop USB port. The LED lights will flash and scroll the word ‘Hello’.

bbc microbit 2

Press buttons as indicated by ‘A’ and ‘B’.

Shake: Fill the screen with dots.

The  accelerometer can detect some of the forces that are acting on it. In this case, if you are shaking it (it can also detecting if it’s upside down) . You can write a program for micro:bit that will tell you how high you threw your it into the air!

Chase the Dot: Move the steady dot by tilting your BBC micro:bit. Catch the flashing dot. Now do it again a few times and you’re done.

 


 

Eject BBC micro:bit

bbc microbit eject

 


 

MakeCode

 

Open app

Click shortcut on taskbar.

58990442-c026ea80-879a-11e9-868a-507566a58c5b

(Alternatively, access the program through a browser at makecode.microbit.org)

 


Select ‘New Project’

Screenshot (227)

 

Screenshot (226)

 


 

Coding options

microbit block javascript

 

  • Block
  • JavaScript 

 


 

Functions

microbit block code options

 


 

Blocks ‘Basics’

 

microbit block basics

 


Adding blocks

  • Open section
  • Find block
  • Drag and drop to canvas

 

micobit block basic code

 


Deleting blocks

  • Select blocks to delete
  • Drag and drop blocks to functions
  • Deposit in ‘Trash’

 

microbit block delete

 


 

JavaScript

 

microbit java basics

 

microbit javascript basic code

 


LED Heart

 

on start

 

Screenshot (230)

 

on start show icon

 

Screenshot (233)

 


 

Try some more shapes

 

on start show icon X

 

microbit different icon (man)

 


 

Set ‘Heart’

  • Go back to set the Heart shaped icon.

 

on start show icon

 

Save

  • Give the file a name
  • Click ‘Save’ icon

 

microbit name and save file

 


 

Download program to BBC micro:bit

Connect micro:bit to laptop with micro USB cable.

There are two options for downloading a file to the micro:bit device:

  • Direct download
  • Transfer saved file (Flashing)

 

Direct download

Select ‘Download’

download

 

Heart icon will appear on the micro:bit’s LED lights.

heart LEDS

 


 

Try other icons

  • Change icon shape
  • Download to BBC micro:bit

 

microbit block shape icons

 


 

Transfer saved file (Flashing)

Files can be transferred directly to a micro:bit in the format of a .HEX file. This process is called ‘flashing’.

Flash memory

  • Solid State Drive (SSD) chip that stores digital data. ‘Solid State’ means there are no moving parts
  • Non-volatile, meaning it remains when a device powers down

Flash memory is commonly used in portable electronics and removable storage devices, such as:

  • Smartphones
  • GPS
  • MP3 players
  • Laptops/tablets
  • USB drives
  • Digital cameras
  • BBC micro:bits

 


A quick reminder about computer memory

There are two types of memory in computers:

Random Access Memory (RAM):

  • ‘forgets’ information when switched off
  • stored information can be re-written
  • temporary storage
  • fast access

Read-Only Memory (ROM):

  • ‘remembers’ information
  • stored information can’t be written (like the operating system)
  • permanent storage (hard drives)
  • slow access

Flash memory has certain things in common with both RAM and ROM. Like ROM, it remembers information when the power is off; like RAM, it can be erased and rewritten over and over again.

Where does the name come from?

Literally, an electrical charge ‘flashes’ across the circuit. The flow of electrons determines whether a ‘1’ or ‘0’ is recorded.

 


Binary Code

Binary code is the simplest form of code, represented entirely by a string of consecutive 0s and 1s. Patterns of 0s and 1s, also known as bits, are assigned to characters, instruction, etc., that computers can understand.

binary code

 

Did you know? The modern binary number system, the basis for binary code, was invented in 1689!

 


.HEX files

Remember we said files can be transferred directly to a micro:bit in the format of a .HEX file.

Standing for ‘Intel hexadecimal object’ file format (or Intel hex format or Intellec Hex), this is a file format that conveys binary information in ASCII text form. It is commonly used for programming microcontrollers, like the BBC micro:bit.

hex file

Flashing

To flash the .HEX file, simply drag and drop it on to the micro:bit drive.

microbit drive

The LED on the back of your BBC micro:bit flashes during the transfer (which should only take a few seconds).

Once transferred, the code will run automatically on your BBC micro:bit. To rerun your program, press the reset button on the back of your BBC micro:bit. The reset button automatically runs the newest file on the BBC micro:bit.

By copying the program onto the MICROBIT drive, you have programmed it into the flash memory on the micro:bit, which means even after you unplug the micro:bit, your program will still run if the micro:bit is powered by battery.

 


Transfer the ‘Heart’ file

This is a two-step process:

1. Go to the Downloads folder

heart file in download folder

 

2. Drag an drop the Heart file to the

download to microbit transfer

 


Factory reset

To wipe a micro:bit’s memory, find the file titled ‘OutOfBoxExperience’.

out of box file

 

Drag and drop it onto the MICROBIT drive.

The micro:bit’s LED lights will show the original ‘Hello’ program.

 


 

 

© Code Champions, March 2020