Ultrasonic sensor on a Kitronik motor driver board

I am not very experienced and have not used the sensor you are using but your issue reminded me of an issue I had recently. See:-
Pico code runs from Thony but will not run on battery or USB power - Core Electronics Forum
Is your code running from Thonny when you are connected to the computer? If so, my thread might give you some clues. I never found the explanation but did find a work around.
Otherwise, just ignore this.
Ian

1 Like