Ampy to transfer files to Pycom microcontroller: Difference between revisions

From Sensors in Schools
Jump to navigation Jump to search
Line 31: Line 31:
sudo pip3 install adafruit-ampy --upgrade
sudo pip3 install adafruit-ampy --upgrade
</syntaxhighlight>
</syntaxhighlight>
= Connecting to Pycom using Ampy =
* To connect to the Pycom enter the following command:
<syntaxhighlight lang="bash">
ampy -p /dev/ttyACM0 ls
</syntaxhighlight>
* Commands need to be entered one at a time.
* This command list the main directory on the Pycom '''/flash'''
* All files on the Pycom are found within this directory.
** '''-p''' the Pycom on the Raspberry Pi is always connected to port '''/dev/ttyACM0'''
[[File:Screenshot 2023-07-29 at 3.54.59 pm.png | 900px]]
* To list all files and directories on the Pycom enter the command:
<syntaxhighlight lang="bash">
ampy -p /dev/ttyACM0 ls -l /flash
</syntaxhighlight>
[[File:Screenshot 2023-07-29 at 3.55.29 pm.png | 900px]]
= Copying or Tranfering files using Ampy =
* Use the '''get''' command to copy files from one device to another.
* The following commands serves as an example for copying the boot.py file from the Pycom to the host computer.
<syntaxhighlight lang="bash">
ampy -p /dev/ttyACM0 get /flash/boot.py /home/pi/boot_backup.py
</syntaxhighlight>
[[File:Screenshot 2023-07-29 at 4.04.18 pm.png | 900ps]]


= Uploading and running micropython programs =
= Uploading and running micropython programs =

Revision as of 06:07, 29 July 2023

Ampy to transfer files to Pycom microcontroller

Authors

For more information contact Adam Simankowicz or Edmond Lascaris

References

Installation of Ampy

sudo pip3 install adafruit-ampy

  • To check that ampy has installed correct enter the following in the Terminal.
ampy --help

  • To upgrade ampy to the latest version enter the code
sudo pip3 install adafruit-ampy --upgrade

Connecting to Pycom using Ampy

  • To connect to the Pycom enter the following command:
ampy -p /dev/ttyACM0 ls
  • Commands need to be entered one at a time.
  • This command list the main directory on the Pycom /flash
  • All files on the Pycom are found within this directory.
    • -p the Pycom on the Raspberry Pi is always connected to port /dev/ttyACM0

  • To list all files and directories on the Pycom enter the command:
ampy -p /dev/ttyACM0 ls -l /flash

Copying or Tranfering files using Ampy

  • Use the get command to copy files from one device to another.
  • The following commands serves as an example for copying the boot.py file from the Pycom to the host computer.
ampy -p /dev/ttyACM0 get /flash/boot.py /home/pi/boot_backup.py

900ps


Uploading and running micropython programs

Using the REPL

  • REPL is an abbreviation (acronym) for Read, Evaluate, Print, and Loop
  • Developers use REPL Python to communicate with the Python Interpreter or Python Shell.
  • You can also input commands and python code directly in the REPL and see the results displayed immediately.

Installing screen to use REPL