Microbit

From Interaction Station Wiki
Jump to navigation Jump to search

intro

This is the page which contains my program for the Online Station Skill "Microbit Programming".

The microbit is a microcontroller of the BBC, presented to all the school children of Great Britain.

In my opinion the microbit is one of the examples of "the next generation" of microcontrollers, the Arduino being the former generation.

Mb12.png microbit simulator - with a speaker - indicated with the plug
Mb13.png Arduino simulator - with a speaker (shouldn't there be a capacitor in series with the speaker?)



Lot's of microcontrollers nowadays, some versions of the Arduino included, have many sensors, neopixels, led displays built in.

This avoid a lot of extra wires and means you can start working with these sensors right away, without practicing the wiring and the soldering.

Programming can be done in a drag and drop way of code blocks.

The microcontroller itself is still the microcontroller comparable to the ATMEGA328, or others ATtiny85, etcetera.

You can also program the microcontroller in Micropython -if a lot of extra memory is included, oftentimes 2MB!

Micropython programming costs a lot of memory more.


Advantage: you can get results faster, avoiding wires, the device with sensors is more compact, often you can even show text. The microbit programming is done online, the simulator is directly besides it. Using the code blocks, in the simulator the parts are added automatically (for example sound - speaker, Bluetooth - another microbit)


Disadvantage: drag and drop coding has its limits. The built in sensors remain the same, while you can buy better sensor versions for your Arduino. In the end you have to learn coding anyway, there is no shortcut in learning a programming language - it takes time and patience.


I personally think the microbit's learning curve is less steep than the Arduino, where you have to do wire connecting and at least some electronics and soldering besides the programming. Although the tutorials at Adafruit and Sparkfun are quite good - you have to know how to install packages for the sensors. It all adds up!

Starting page

https://microbit.org

Mb1.png


Introduction videos from the bbc:

https://microbit.org/get-started/first-steps/set-up/

drag and drop download of the hex file. Although this is an online programming course not really supposing you buy the microbit, if you have one: I think the downloading of the hex file of the code and dragging it into the microbit disk is always a bit ...slow. Many steps, many clicks.


bluetooth download (upload)

So why not try this: https://microbit.org/get-started/user-guide/web-usb/

In Chrome, with the right firmware, it seems to go "fast"!

Mb3.png But this is not the right firmware! (It must be the 250 Mb4.png


What I like is the editor, together with the simulator:

Mb2.png



First steps: immediate results

I have made a few screen video's showing how to generate some very easy results.

Directly show some text. Adding a behavior to an input button is "so easy"!

https://www.youtube.com/watch?v=FvmgzU7Dz2k

The light sensor:

https://www.youtube.com/watch?v=krgxXSAEYl0&t=28s

The temperature sensor:

https://www.youtube.com/watch?v=krgxXSAEYl0




Other Programming Languages

Better not look at this when you are just beginning with microcontrollers!

Below the surface microcontrollers are very complex stuff.

It is quite easy to go to JavaScript, using the slider in the Make Code editor.

Mb5.png Mb6.png

If you happen to know a bit of Python, you can start micropython. Also from its own "mu" editor on your laptop:

https://codewith.mu/en/download

Although opening this mu editor on the MAC has to be like this (at the moment) Open the contents of the Mu editor in Applications Then in terminal window: sudo /Applications/mu-editor.app/Contents/MacOS/mu-editor

Mb9.png Mb10.png

You can also install a package for AVR C/C++ programming. https://lancaster-university.github.io/microbit-docs/

Although installing this is quite a challenge. Mb11.png