Little experience with electronics: PiicoDev distance sensor VL53L1X:

I’ve been experimenting with a range of PiicoDev products and as suggested programming them through Thonny and using a BBC Micro:Bit V2 as my microcontroller.
I have been having a heap of fun with the distance sensor/ musical instrument and have a few questions…

  1. I was wondering if I can rejig the code to play other musical notes such as A, G, C, B, D, E and F? If so, do I just modify the code?

  2. Before I started playing with the distance sensor, I had the atmospheric sensor programmed in Thonny…
    a) do I need to upload the and unified files from each video tutorial or are they the same files for every PiicoDev program?
    b) Is it possible to add another motion sensor to the program to eliminate the need to continually hold down button A on the micro:bit and to make this a hands free instrument?

  3. Is there a way to save each project individually in Thonny?

Thank you for any advice you may have


Hi Eleanor,

Welcome to the forum :slight_smile:

The file handles setting up the I2C communications bus for each of the 3 microcontrollers that PiicoDev is designed to work with, in your case the micro:bit. This is the same file in every PiicoDev tutorial, so you can just leave it in place. is a special case as this is a reserved name that your micro:bit will try to run whenever it is powered on. is different for each of our PiicoDev tutorials so if you wanted to use two different sensors you’ll need to graft bits and pieces from both of the files from the tutorials to make a new that handles the initialisation and logic for both.

Since most of your programs are going to have a in them it’s best to setup a folder for each project on your computer then just keep all the files associated with that project in the same location.

Absolutely, if you’re adding another PiicoDev sensor you’ll just need the driver file for it (eg. is the driver for the distance sensor). Then each sensor will usually have some intialisation that happens once before the main program loop, and a piece of code that is called continuously as your program runs which sits inside the main loop.

That’s right, the example program has some notes defined in the initialisation section, then the number in the code chooses which note should play.

If you wanted to look further into how the notes are work you can find the tutorial for the micro:bit’s music module here.


Hello Trent
Appreciate you taking the time to respond with such great advice. I’ll be looking into every glue you’ve shared. It’ll keep me busy over the next couple of days. Stay tuned please.
Kindest regards,