0

I am trying to load a program on a Raspberry Pi Pico. Have loaded the standard blink program on it using USB connected to my Macbook and used Thonny to run and stop the program. However if I disconnect the Raspberry Pi Pico, from the USB, the program disappears. I found this video (https://www.youtube.com/watch?v=IMZUZuytt7o) that shows how to make it work with a windows system, but if I try the same with Macbook does not work. It gets stuck at Trying to connect to REPL

Can someone suggest how we can flash the program on the Raspberry Pi Pico so that it stays whenever we connect it to power?

Here is the program I tried

import machine
import utime
led_onboard = machine.Pin(25, machine.Pin.OUT)
while True:
    led_onboard.value(1)
    utime.sleep(1)
    led_onboard.value(0)
    utime.sleep(.5)

2
  • Have got beyond the "Trying to connect to REPL". The problem I am having is that although I can copy the main.py program to /pyboard/main.py, when I disconnect and reconnect the program does not run. I have confirmed that the files I copy remain. Commented Feb 2, 2021 at 7:40
  • You may want to edit the question to reflect the updated situation. Commented Feb 3, 2021 at 22:37

1 Answer 1

0

I tried using the suggested RShell solution using pip install rshell. However it does not seem to work on macbook very well when it comes to copying the program to the pico. So I tried an alternate REPL writer called ampy

To install ampy follow the guide on https://github.com/scientifichackers/ampy

pip install adafruit-ampy

In your shell go to the folder where the program is stored. Keep the file name as main.py

Run ampy using the command
ampy -p /dev/cu.usbmodem0000000000001 put main.py

The format is

ampy –p [USB-Port] put [file to copy]

The file is now copied into the board.

Now if you unplug and re-plug the power source the program in main.py would execute.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.