0

My code:

print("hello world")

I want this file to run when I start the Raspberry Pi Pico. I named it main.py but when I unplugged and plugged the Raspberry Pi Pico into my computer the program didn't start.

user4157124
  • 2,809
  • 13
  • 27
  • 42

1 Answers1

1

in order to get the output of the device on your machine (Windows, Linux or Mac) you have to open the port to see that output, e.g. with PuTTY, rshell, mpremote... Whenever you unplug and replug the device that port might be different depending on the machines operating system.

Other than that it could be also the case that your device is printing the message before you even connected to that port and your program finished already when you open the port.

You could change you code of the main.py file to the following to print "Hello World, iteration #x" in an endless loop with a one second delay between two messages.

import time
iteration = 0
while True:
    iteration += 1
    print("Hello World, iteration #{}".format(iteration))
    time.sleep(1.0)
  • 1
    To make sure "main.py" is running have the on board LED blink. This is the "hello world" version for microcontrollers. – Peter I. Aug 30 '23 at 11:43