Page 1 of 1

Push files from local to PyBoard

Posted: Tue May 14, 2019 1:02 am
by Kip
Hi,

I'm just wondering if there are any methods/projects that would allow me to send files and commands to the PyBoard. I would like to work in a directory on my computer (so I can use git) but not manually copy and paste the files to the pyboard every time. I imagine one command that:
git add .
Pushes the files from local to pyboard
Restarts the pyboard (ctrl+d)
starts displaying the output of the pyboard

I'd write the script myself but I'm scared of changing the write permissions of my /dev/ttyACM0 file as I don't have any experience doing this type of stuff.

If there is an existing/similar method, could someone please point me in that direction. I fear I lack the jargon to google the correct question.

Thanks,

Kip

Re: Push files from local to PyBoard

Posted: Tue May 14, 2019 2:12 am
by jimmo
I mostly use the pyboard.py tool that is part of the MicroPython repo (which is great for testing short scripts because it never writes them to the filesystem at all), but I think what you probably want is https://github.com/dhylands/rshell/blob ... README.rst

Re: Push files from local to PyBoard

Posted: Tue May 14, 2019 5:45 am
by Damien
You may also be interested in the following tool: https://github.com/micropython/micropython/pull/3034

Re: Push files from local to PyBoard

Posted: Wed May 15, 2019 6:57 am
by Kip
Great, that's just what I needed!

If anyone is interested, I did the following to get what I wanted:

1. Install rshell

Code: Select all

sudo pip3 install rshell
2. Create a custom command by making a upyrun file in /usr/bin/

Code: Select all

sudo nano /usr/bin/upyrun
3. Add the following commands to the upyrun file:

Code: Select all

git add .
rshell cp *.py /sd
rshell repl pyboard import main
I import main to get the main.py file running on the pyboard
Change /sd to /flash if you are not using an sd card

4. make command file executable

Code: Select all

sudo chmod +x /usr/bin/upyrun

5. run the command in the directory that your files are kept on your machine and that are to be reproduced on the pyboard.

Code: Select all

sudo upyrun
This is great because the files are ready to be used straight away unlike when you are editing the files directly from the PyBoard as it can take some time for the files to update after saving.

FYI: to stop code running on the pyboard use ctrl+c and to exit the repl use ctrl+x

Re: Push files from local to PyBoard

Posted: Thu May 16, 2019 10:28 pm
by Kip