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)

DazWilkin
  • 32,823
  • 5
  • 47
  • 88
Raj Oberoi
  • 654
  • 1
  • 7
  • 18
  • 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. – Raj Oberoi Feb 02 '21 at 07:40
  • You may want to edit the question to reflect the updated situation. – larsks Feb 03 '21 at 22:37

1 Answers1

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.

Raj Oberoi
  • 654
  • 1
  • 7
  • 18