{"id":15061538,"url":"https://github.com/paulober/pico-mpy-com","last_synced_at":"2026-01-03T01:05:10.364Z","repository":{"id":255387290,"uuid":"846648334","full_name":"paulober/pico-mpy-com","owner":"paulober","description":"A Node.JS library for communicating with USB devices running the MicroPython firmware.","archived":false,"fork":false,"pushed_at":"2024-11-17T21:43:22.000Z","size":224,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T02:14:50.424Z","etag":null,"topics":["micropython","micropython-rpi-pico","nodejs","raspberry-pi-pico","raspberry-pi-pico-2","raspberry-pi-pico-micropython","serialport"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paulober.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-23T16:48:43.000Z","updated_at":"2024-11-17T21:42:44.000Z","dependencies_parsed_at":"2024-09-10T19:06:30.713Z","dependency_job_id":"e12fd1dd-6812-4248-89ad-4c2dd2e4724d","html_url":"https://github.com/paulober/pico-mpy-com","commit_stats":{"total_commits":59,"total_committers":1,"mean_commits":59.0,"dds":0.0,"last_synced_commit":"8add2e36f5986da9d48becc44d9f057ac41cf9fd"},"previous_names":["paulober/pico-mpy-com"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulober%2Fpico-mpy-com","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulober%2Fpico-mpy-com/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulober%2Fpico-mpy-com/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulober%2Fpico-mpy-com/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paulober","download_url":"https://codeload.github.com/paulober/pico-mpy-com/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243723073,"owners_count":20337303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["micropython","micropython-rpi-pico","nodejs","raspberry-pi-pico","raspberry-pi-pico-2","raspberry-pi-pico-micropython","serialport"],"created_at":"2024-09-24T23:21:00.684Z","updated_at":"2026-01-03T01:05:10.338Z","avatar_url":"https://github.com/paulober.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pico MPY Com\n\nThis is a simple NPM package for communicating with a Raspberry Pi Pico boards running MicroPython.\nIt utilizes serial over USB to communicate with the board.\n\n\u003e Note: It's possible to use this package with other boards running MicroPython, but it's not guaranteed to work. In order to do so, you need your own port detection as the built-in one is specific to Raspberry Pi Pico MicroPython firmware (CDC) | Vendor ID = `0x2E8A` and Product ID `0x0005`.\n\n## Installation\n\n\u003e Note: It's required to authenticate with the GitHub package registry in order to install this package. [github/docs](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry)\n\n```bash\nnpm install @paulober/pico-mpy-com\n```\n\n## Usage\n\n```typescript\nimport { PicoMPYCom, PicoSerialEvents, OperationResultType } from '@paulober/pico-mpy-com';\n\n// Get a list of available serial ports\nconst ports = await PicoMPYCom.getSerialPorts();\n\n// List all ports\nfor (const port of ports) {\n    console.log(`- ${port}`);\n}\n\n// Retrieve the singleton instance of the PicoMPYCom class\nconst serialCom = PicoMpyCom.getInstance();\n\n// Listen for connection events\nserialCom.on(PicoSerialEvents.portOpened, () =\u003e {\n    console.log(\"\\x1b[32mSuccessfully connected to the board.\\x1b[0m\\n\");\n});\n\nserialCom.on(PicoSerialEvents.portClosed, () =\u003e {\n    console.log(\"\\x1b[31mThe board has been disconnected.\\x1b[0m\");\n});\n\nserialCom.on(PicoSerialEvents.portError, error =\u003e {\n    console.error(`${error}`);\n});\n\n// Connect to the first available port\nawait serialCom.openSerialPort(ports[0]);\n\n// Send a predefined Hello World command to the board\nconst result = await serialCom.helloWorld();\n// Check the result type\nif (result.type === OperationResultType.commandResponse) {\n    console.log(`Response: ${result.response}`);\n} else {\n    console.error(\"An error occurred while sending the command.\");\n}\n\n// Close the connection to the serial port\n// This is important as keeping the port open\n// will prevent other applications from using it\nawait serialCom.closeSerialPort();\n```\n\n\u003e Note: The ports detected are filtered by `vendorId` and `productId` of the Raspberry Pi Pico board with MicroPython (CDC) firmware.\n\n## Docs (TODO)\n\n\n## License\n\nThe project is licensed under the Apache 2.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulober%2Fpico-mpy-com","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulober%2Fpico-mpy-com","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulober%2Fpico-mpy-com/lists"}