{"id":28392423,"url":"https://github.com/shmishtopher/gpio","last_synced_at":"2026-05-04T23:39:23.432Z","repository":{"id":52976800,"uuid":"138427992","full_name":"shmishtopher/GPIO","owner":"shmishtopher","description":"🚀 GPIO Pin control in JS using the gpiochip character device","archived":false,"fork":false,"pushed_at":"2021-04-11T16:12:40.000Z","size":1305,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-31T23:43:10.094Z","etag":null,"topics":["character-devices","gpio","javascript","nodejs","rust-bindings"],"latest_commit_sha":null,"homepage":"https://shmishtopher.github.io","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shmishtopher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-23T19:26:02.000Z","updated_at":"2023-10-03T09:35:52.000Z","dependencies_parsed_at":"2022-08-30T23:42:57.962Z","dependency_job_id":null,"html_url":"https://github.com/shmishtopher/GPIO","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shmishtopher/GPIO","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shmishtopher%2FGPIO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shmishtopher%2FGPIO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shmishtopher%2FGPIO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shmishtopher%2FGPIO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shmishtopher","download_url":"https://codeload.github.com/shmishtopher/GPIO/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shmishtopher%2FGPIO/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32629472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["character-devices","gpio","javascript","nodejs","rust-bindings"],"created_at":"2025-05-31T12:45:50.085Z","updated_at":"2026-05-04T23:39:23.426Z","avatar_url":"https://github.com/shmishtopher.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AR_GPIO\n:rocket: GPIO Pin control in JS using the gpiochip character device\n\nAR_GPIO aims to provide the portablity of the sysfs GPIO interface while preserving the speed of direct regiter access (achieved by using the gpiochip character device in `/dev/gpiochipN`).  The libray is very mininal, providing only the core GPIO functionality and is fast enough to work with soft-PWMs.\n\n1. [`Install`](#install)\n2. [`Examples`](#example)\n3. [`Building`](#building)\n4. [`API`](#api)\n\n\n## Platform Support\n| Confirmed Working   | Should Work*   | Confirmed not Working |\n|---------------------|----------------|-----------------------|\n| Raspberry Pi Zero W | Raspberry Pi 2 |                       |\n| Raspberry Pi Zero   | Raspberry Pi 3 |                       |\n| C.H.I.P             | Beagle Bone    |                       |\n\n\\*Untested\n\n# Install\nAR_GPIO is build on [`fastcall`](https://www.npmjs.com/package/fastcall), which uses cMake instead of node-gyp.  Install cMake before installing AR_GPIO\n```\n# Install C++ Toolchain\nsudo apt-get update\nsudo apt-get install build-essential\n```\n```\nsudo apt-get install cmake  # AR_GPIO depends on cmake\n```\n```\nnpm i --save https://github.com/shmishtopher/GPIO  # Node dependency\n```\n\n\n# Example\n![cylon eyes](examples/cyloneyes.png)\n```JavaScript\n// Cylon Eyes\n\nconst { GPIOChip, OUTPUT, HIGH, LOW } = require('ar_gpio')\n\nconst chip = new GPIOChip(0)\nconst lines = [\n  chip.line(14, OUTPUT),\n  chip.line(15, OUTPUT),\n  chip.line(18, OUTPUT),\n  chip.line(23, OUTPUT),\n  chip.line(24, OUTPUT)\n]\n\nfunction sleep (ms) {\n  return new Promise(resolve =\u003e setTimeout(resolve, ms))\n}\n\nasync function main () {\n  while (true) {\n    for (let i = 0; i \u003c 4; i++) {\n      await sleep(50)\n      lines[i + 0].set(LOW) \n      lines[i + 1].set(HIGH)\n    }\n\n    for (let i = 4; i \u003e 0; i--) {\n      await sleep(50)\n      lines[i + 0].set(LOW)\n      lines[i - 1].set(HIGH)\n    }\n  }\n}\n\nmain()\n```\n\n# Building\nBuilding requires the Rust compiler.  The easist way to get RustC and Cargo is with `Rustup`\n```\ncurl https://sh.rustup.rs -sSf | sh -s -- --help\n```\nWith the Rust compiler installed you can build with the NPM script.\n```\nnpm run build\n```\n\n# API\nInitilize a new GPIOChip:\n```JavaScript\n/**\n * @param {Number} chip;  The gpio chip to use.  \n * If your gpio chip is at /dev/gpiochip0 then \n * the `chip` param is `0`\n */\n\nconst myChip = new GPIOChip(0)\n```\n\nExport a GPIO line:\n```JavaScript\n/**\n * @param {Number} line;  The BCM pin to export\n * @param {Number} flags;  The flags you need, ORd together\n */\n\nconst inputLine = myChip.line(17, INPUT | ACTIVE_LOW)\nconst outputLine = myChip.line(21, OUTPUT)\n```\n\nRead a GPIO line:\n```JavaScript\n/**\n * The line must be exported as an INPUT before using `.get()`\n * @returns {HIGH | LOW} state;\n */\n\nif (inputLine.get() === HIGH) {\n  console.log('Line 17 is HIGH')\n}\n```\n\nWrite to a GPIO line:\n```JavaScript\n/**\n * The line must be exported as an OUTPUT before using `.set()`\n * @param {HIGH | LOW} state;  The state to set.\n */\n\noutputLine.set(HIGH)\n// Or...\noutputLine.set(1)\n\n\noutputLine.set(LOW)\n// Or...\noutputLine.set(0)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshmishtopher%2Fgpio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshmishtopher%2Fgpio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshmishtopher%2Fgpio/lists"}