BBC micro:bit Impressive introduction into programming

This weekend, I got a BBC micro:bit from a friend. This is a nice gift indeed, I had and still have lot’s of fun with it.

Before I tell a bit more about the device, did you know each 11- and 12- year-old student in the UK got one for free!? That’s more than one million devices. This is a great opportunity for kids: they can learn about programming, computers and most of all, programming and computers can be fun!

The design of the device is very clever!

It has an ARM processor, two buttons, 25 leds (which acts like a screen), a compass, an accelerometer, Bluetooth LE, GPIO pins, a battery connector and a MicroUSB connector (for programming).

microbit

Programming is so easy! Let’s dive into this a bit deeper…

Just connect the micro:bit to your computer (using a microUSB cable) and go to the website. It’s so smart, children do not have to download anything, programming is done inside the browser using one or programming tools (as I said, running on a web page):

  • Microsoft PXT (beta) – Our new micro:bit Programming Experience Toolkit (PXT) editor provides a programming experience supporting both a block-based editor and JavaScript, along with great new features like peer-to-peer radio
  • Micro Python -MicroPython is a completely text-based editor, perfect for those who want to push their coding skills further. A selection of ‘snippets’ are on hand to help auto-complete trickier tasks and a range of premade images and music are built-in to give you a helping hand with your code
  • Microsoft Block Editor – The Block Editor is a visual editor and provides an introduction to structured programming via drag and drop coding blocks that snap together. You can also convert a Block Editor script into a Touch Develop script which helps with the transition to text-based programming
  • Code Kingdoms JavaScript – Code Kingdoms is a visual JavaScript editor. It has a drag-and-drop interface making it accessible to beginners. You can also change from the visual editor to a text-based editor which supports the transition to text-based programming as the learner’s coding skills progress
  • Microsoft Touch Develop – With its touch-based interface, Touch Develop has been designed for mobile devices with touchscreens. It can also be used with a pc, keyboard and mouse. Touch Develop introduces a statically-typed scripting language with syntax-directed editor. It can be used to produce web-based apps that can run online on any platform

 

The micro:bit mobile app (Google play store, Apple app store) lets you send code to your micro:bit using Bluetooth wireless technology. No connecting leads needed! Just make sure that your micro:bit is powered up and within easy reach of the phone or tablet running the app.

I tried another way to program it. Whenever my application was ready, I hit the download button on the screen. A microbit-[insert project name].hex file was compiled and download into my downloads folder. I then dragged the file to a newly created drive on my PC. This drive was created when I attached the micro-bit, the device act like a drive! And when the hex file was dropped, the micro:bit reboots with this new application. Sweet, even a child can do this!

Programming

All programming languages (both visual and those using code) have the same capabilities (Python seems to be missing the Bluetooth stack at this moment, though).

My first impression is that it acts just like Scratch, a very popular programming language, running on multiple devices and environments eg RaspberryPi.

Here is picture where I program in PXT:

mb1

In the middle, I can choose programming modules (like shown on the right) from various categories (each with its own color) eg.:

mb01 mb02 mb03 mb04 mb05 mb06

So there is a lot of things to do.

I think the most fun is to interact with the sensors. The compass can show you the north of any other wind direction. The accelerometer knows when you wobble or flip the device. The buttons are great to interact with the ‘screen’ (I have plays a very simple version of snake, directing only three dots on the screen).

I also tried the GPIO pins. It’s possible to read the pins in code and interact with them using your fingers. I had some issues with that (nothing happened while connecting pin Zero and ground and ), but finally I managed to interact with the pins a few times.

I recommend a better solution for the GPIO pins, use a programming board like this one:

kw-1784-3-1000x667

And I can also recommend the battery pack having a JST connector. This is a must-have if you want to use the compass or accelerometer.

Before I go further, in the browser there is also a simulator. And it is very smart. If you program a device to use Bluetooth, It will show two devices in the emulator which can interact. Nice!

Javascript

The same PXT program can be seen and change as JavaScript in this editor:

mb07

These devices cost around 18 Euro in The Netherlands and it’s pretty cheap for the amount of fun you buy with it!

Bluetooth

As a more experienced programmer, I tried to program against the Bluetooth stack of the micro:bit. TLDR; I failed.

Ok, I managed to pass some data using the BLE advertisement. I send a 4 and a 2:

mb09

These two values are shown using the Bluetooth Beacon interactor (code available on Github):

mb08

But the Bluetooth stack of the micro:bit is much more promising, due to all the GATT profiles:

mb10

But after pairing, all I got was:

mb11

I even have seen that the device had six profiles but I did not get it working. Could be that it is not supported yet by UWP apps, I will check it out in a future blog.

Conclusion

I can recommend the micro:bit to anyone: child, parent, teacher, President of the United States,  anybody. Although small and cheap, it is pretty powerful and easy to program. And it is versatile enough to compete with NodeMCU or Arduino.

 

 

 

 

 

 

 

 

 

Advertenties