You Reply:Thanks Nana,
I can use another Makcode extension designed for taking sonar sensor readings https://makecode.microbit.org/pkg/microsoft/pxt-sonar but it seems to crash the program when I try to upload the hex file to the Micro:Bit (if I also install the Maqueen extension so I can access the motors). I've made a fork of the Github project and commented out that line (https://github.com/evandevon/maqueen/) - seems to work in Makecode now. This is my first time using Github so I hope I followed the correct procedure and haven't offended anybody.
You Reply:Thanks for your response,
Trying to attach images or other files results in an error so here's a link to the files. https://1drv.ms/u/s!AqeCPpkT_M3AhotG2CgJFHaB2f56Ug
I've included two screenshots from Makecode. One showing the code I used and the other showing the serial output (as referenced in the previous message). There's also a hex file of which the code screenshot was taken in case it is useful - However it just seems like that code I referenced in the previous message is designed to always send the current distance measurement over serial as "Distance: <value> " , and appears to happen whenever the distance measurement is taken, regardless of the code I use.