Menu Close

Raspberry Pi Pico File Directory and Autorun


File Directory

To see the saved files, connect the Raspberry Pi Pico and run Thonny. Go to View and select Files:

When inserting the Raspberry Pi Pico in Removable Drive mode (pressing and holding the BOOTSEL button when inserting it in a USB port), I assumed that I would be able to see the python files I saved on it, but that is not the case.

Now you can see the files saved before:

Raspberry Pi Pico File Directory

By right clicking, you get the options to open the file, download or delete it, check its properties or create a new directory. Rename, move, copy does not seem to be available.


Autorun

Microcontrollers are standalone devices that start executing the code saved on them as soon as they are powered on. However, the blinker.py program saved on Raspberry Pi Pico doesn’t execute when we power it up. The reason is that this isn’t the main code saved on the microcontroller. Raspberry Pi Pico is configured to run the MicroPython Interpreter. We can instruct MicroPython to run the blinker.py through Thonny IDE, but it would not run by itself when Raspberry Pi Pico is powered up.

The MicroPython Interpreter however will run a program by itself, if it’s saved in a file named main.py

Since there’s no option to rename our blinker.py we can open it and then save as main.py

Use Save As to achieve renaming

Click on Raspberry Pi Pico

Click on Raspberry Pi Pico

Save as main.py

Save as main.py

When OK is clicked, the file is saved and appears in the Files panel

main.py appears in the Files panel

Now if we unplugthe Raspberry Pi Pico and power it up independently, the onboard LED starts to blink by itself without having to run the program through Thonny.


Regaining control through Thonny

When the MicroPython Interpreter is busy running the main.py it isn’t connected to Thonny. Press CTRL+F2 to stop the execution of the python program and connect MircoPython to Thonny.

 1,383 total views,  4 views today

Leave a Reply

Your email address will not be published. Required fields are marked *