romilly / pico-code

MicroPython code for the Raspberry Pi Pico

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code for Raspberry Pi Pico

Some projects also requires an attached Raspberry Pi (the host) running additional code.

The docs/<project>.md file describes each project.

Code for the Pico is in src/pico_code/pico. Code for the Host is in src/pico_code/host.

Host code has been tested on a Raspberry Pi connected to a Raspberry Pi Pico under Python 3.7. It may need modification to run on other Linux, Windows or Mac computers.

Talker

The first project talker uses a Talker based on PySerial to send commands from the Pi to the Pico and read output from the Pi.

Function Generator

fungen is a minimalist AF (Audio Frequency) generator based on the Pico.

MCO3008

mcp3008 is a MicroPython driver for the MCP3008 8-channel SPI ADC.

Resistomatic

resistomatic is a crude Ohm meter.

Serial communications with UART1

UART demo shows how to do serial communications using UART 1.

(Very) Experimental VS Code support

I have started exploring VS Code. If you look in the .vscode directory you'll see a tasks.json file that sets up user tasks.They invoke scripts that use ampy to copy a file or the contents of a directory, and one (use with care!) that will remove all the .py files from the Pico.

  1. pico list lists all the files on the pico.
  2. pico put all requires you to have a file open in the editor. It copies all the files in the parent directory from the host to the pico.
  3. pico put copies the currently open file from the host to the pico.
  4. pico clear asks for confirmation, and then removes all files from the pico. Use it with care!.

The scripts (which are in the scripts directory) are currently Linux-only; I have tested them with Linux Mint on a workstation and with Raspberry Pi OS on a Pi.

I'd be delighted if someone with access to Windows or Mac OSX could add scripts and edit the tasks.json file to make the tasks available in those environments.

You'll need to use chmod to make the scripts executable, and you need to install ampy.

cd scripts
chmod a+x *.sh
sudo python3 -m pip install adafruit-ampy

About

MicroPython code for the Raspberry Pi Pico

License:MIT License


Languages

Language:Python 98.2%Language:Shell 1.8%