Raspberry Pico Permanent code
13/02/2021 | Views: 379 | Arduino | by: ELECTRONOOBS      


But wait a minute. If I disconnect the USB cable and plug it back in, as you can see in the video below, the LED is not blinking anymore. Well that’s because we were running the py code from our PC. If you want the code to automatically run when you power the raspberry PICO, you need to add that code to the microcontroller.





Creating main.py


Here’s how we make the code run automatically from the pi. Create a new file in thonny. Click save and here, select to save it to the raspberry pico. Now is important to name this file main.py. If you give it a different name, it won’t run automatically. The Pi is always looking for a main dot pi file. Add your code inside this file. Now, when you click the save button, the changes are saved to the main.py file that’s on the microcontroller memory. As you can see below, the LED is blinking. I remove the USB cable and connect it back on. And there you go, the LED is blinking automatically without me running it from the PC. Nice!


micropython permanent code






13/02/2021 | Views: 379 | Arduino | by: ELECTRONOOBS      












Last tutorials

Escaperoom Puzzle
Raspberry Pi PICO ADC + Temperature Example
Upload permanent code to Raspberry Pi PICO
Raspberry Pi PICO LED blink Example
Starting with Raspberry Pi PICO

ADVERTISERS



ADVERTISERS

PCBWAY PCB service

PCBWAY PCB service





Arduino curso en español desde cero