Skip to content

This project is a node package for a simple communication with the Raspberry Pi Pico and Pico W boards. It includes a wrapper for the pyboard.py tool from MicroPython and other helpers.

License

Notifications You must be signed in to change notification settings

paulober/pyboard-serial-com

Repository files navigation

pyboard-serial-com

A straightforward library for establishing communication with Raspberry Pi Pico (W) boards using the pyboard.py utility (from the MicroPython project) via the serial port.

Now with experimental ESP32-WROOM, ESP32-S3, ESP32-C3 and Teensy 4.0 support!

This projects main/initial purpose is to offload the communication core and utilities from the MicroPico repo into a seperate repository for development and usability reasons. Also it is/was meant to replace the old ugly asynchronous mess of a communication piece to allow the developement of new more complex features based on the official pyboard.py module developed on the MicroPython repo.

Installation

Before installing, make sure to authenticate with GitHub Package Registry or using a .npmrc file. See "Configuring npm for use with GitHub Package Registry."

$ npm install @paulober/pyboard-serial-com

Or add this package to your package.json file:

"dependencies": {
    "@paulober/pyboard-serial-com": "3.0.9"
}

NOTE: requires the scripts directory to be present in your work-/output directory

Supported platforms

Platform Architectures
Windows x64
Linux x64, arm64, (armhf)
macOS (10.9 or higher) x64, arm64

Usage

import { PyboardRunner } from "@paulober/pyboard-serial-com"

const pyboardRunner = new PyboardRunner(
    "COM3",
    115200,
    (data: Buffer | undefined) => {
        if (data !== undefined) {
            console.error(`stderr: ${data?.toString()}`)
        } else {
            // connected sucessfully
            console.debug("Connected!")
        }
    },
    (code: number, signal: string) => {
        if (code) {
            console.error(`child process exited with code ${code}`)
        }
        if (signal) {
            console.error(`child process killed with signal ${signal}`)
        }
        console.debug("Done - exit")
    }
)

pyboardRunner.disconnect()

Planed changes

  • Maybe switch to RXJS compared to the current custom solution for queueing

Known issues

...

About

This project is a node package for a simple communication with the Raspberry Pi Pico and Pico W boards. It includes a wrapper for the pyboard.py tool from MicroPython and other helpers.

Topics

Resources

License

Stars

Watchers

Forks