Ampy to transfer files to Pycom microcontroller
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
Get files from Pycom using Ampy
- Use the get command to copy files from the pycom.
- The following commands serves as an example to get the boot.py file from the Pycom to the host computer.
ampy -p /dev/ttyACM0 get /flash/boot.py /home/pi/boot_backup.py
- The get command without a destination file name will print the contents of the file.
Put files onto the Pycom using Ampy
- Put files onto the Pycom with the command:
ampy -p /dev/ttyACM0 put /home/pi/test.py /flash/test.py
Run code using Ampy
- You can copy code to the Pycom and then run the code.
- Save the following code in a file named /home/pi/test.py
print('Hello world! I can count to 100:')
for i in range(1,100):
print(i)