Part 4 – Displaying the Acceleration

When we ran the program last time, it was hard to see the numbers changing, as the numbers are only updated every half second. This is because the program has the line:

sleep(500)


The number passed to the function ‘sleep’ is in milliseconds (which can be written as ms), where 1000ms = one second. If we change the sleep time to be 100(ms), the numbers scroll up the screen too quickly.

It would be nice if the output was to a single place on the screen, but that does not seem possible with the serial output from MicroPython. There is also another problem – the cable supplied is too short, so device can not be moved very far in any direction.

We thought about using Bluetooth as a way of communicating between the micro:bit and a laptop. Getting this set up is quite complex, and a distraction from this project, but something we might look at as our next project. We found this useful article on using Bluetooth on the micro:bit to send data to a PC.

When we started to look at the code used by that article, it became clear that they were using a rival to the MicroPython system – the Microsoft Makecode system. I’m sure that has its merits, but we have started along the path of using MicroPython.

However, despite, or because of, these distractions, we thought of a way of displaying the acceleration, and from there velocity and distance ….

Micro:bit to the Moon is Storm Educational’s contribution to helping children be interested in coding/STEM. Code can be freely downloaded, adapted and used. But if a school could mention our software for primary/elementary students we would be very grateful stormeducational.co.uk (with free online demos at stormedapps.co.uk).

Leave a comment