I've got hold of the new Pico 2 and have tried a graphics program to make use of the extra memory. I'm using a Waveshare 2" Pico display with 320 by 240 pixels and the latest available MicroPython uf2 (v1.24.0-preview.201.g269a0e0e1 (2024-08-09) .uf2) and have hit a snag. The Waveshare display driver is included in the code and works perfectly.
To get this loop to terminate I have to include an 'unnecessary' print statement.
for i in range(r, 0, -1):
print(i) # <==================== WHY IS THIS NEEDED? ==================
LCD.ellipse(centre_x, centre_y,i+1, i+1,colour(i*5,i*3,i*4), 1)
LCD.show()
time.sleep(0.1)
If I leave it out the Pico 2 locks up at the end of the loop and if I click on the STOP icon in Thonny I get the message:
Unable to connect to COM3: could not open port 'COM3': PermissionError(13, 'Access is denied.', None, 5)
If you have serial connection to the device from another program, then disconnect it there first.
Process ended with exit code 1.
If I include the print statement it runs through to the following code as expected.
The full code can be found here:
https://pastebin.com/Fmk5iQ18
I wonder what is going on.
I know this is a 'preview' version of the UF2 but I was not expecting a problem with a counted for loop! Any ideas?