{"id":17816470,"url":"https://github.com/zebrajaeger/remote-i2c","last_synced_at":"2025-04-02T08:26:04.126Z","repository":{"id":57170439,"uuid":"309129477","full_name":"zebrajaeger/remote-i2c","owner":"zebrajaeger","description":null,"archived":false,"fork":false,"pushed_at":"2020-11-03T08:00:40.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T19:02:46.557Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/zebrajaeger.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}},"created_at":"2020-11-01T15:45:06.000Z","updated_at":"2020-11-03T08:00:28.000Z","dependencies_parsed_at":"2022-08-27T12:02:03.100Z","dependency_job_id":null,"html_url":"https://github.com/zebrajaeger/remote-i2c","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebrajaeger%2Fremote-i2c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebrajaeger%2Fremote-i2c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebrajaeger%2Fremote-i2c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebrajaeger%2Fremote-i2c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zebrajaeger","download_url":"https://codeload.github.com/zebrajaeger/remote-i2c/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246779917,"owners_count":20832486,"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":[],"created_at":"2024-10-27T16:38:13.330Z","updated_at":"2025-04-02T08:26:04.105Z","avatar_url":"https://github.com/zebrajaeger.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# i2c-over-http\n\n[![NPM](https://nodei.co/npm/@zebrajaeger/remote-i2c.png?compact=true)](https://npmjs.org/package/@zebrajaeger/remote-i2c)\n\nTransparent connection to local i2c-bus or remote i2c-bus via http rest interface.\n\n## Start Server from commandline\n\n```bash\n$ i2c-server --help\nUsage: i2c-server [options]\n\nOptions:\n  -b, --busNumber \u003cnr\u003e   I²C-Bus number (default: \"0\")\n  -p, --port \u003cport\u003e      Port to bind on (default: \"8080\")\n  -h, --host \u003chostname\u003e  Host, IP, ... to bind on (default: \"0.0.0.0\")\n  --help                 display help for command \n```\n\n## Use Client from commandline\n\n```bash\n$ i2c-read --help\nUsage: i2c-read [options]\n\nOptions:\n  -p, --port \u003cport\u003e        Port for send request to (default: \"8080\")\n  -h, --host \u003chostname\u003e    Host for send request to (default: \"localhost\")\n  -a, --address \u003caddress\u003e  i²C Address (default: \"0\")\n  -c, --count \u003ccount\u003e      Number of bytes to read (default: \"1\")\n  --help                   display help for command\n```\n\n## Use Client from code\n\nFor remote connection, first start server on the remote device.\n\n```javascript\n// const {HardwareI2C} = require('@zebrajaeger/remote-i2c');\nconst {HardwareI2C, HttpI2C} = require('../src/client');\n\n// for local execution use this one\n//const i2c = new HardwareI2C(1); // on raspberry pi, we use i2c-bus #1\n\n// for remote execution use this one\nconst i2c = new HttpI2C('192.168.178.69', 8080); // remote raspberry pi\n\n(async () =\u003e {\n    try {\n        // read two 16 bit values (from i2c-joystick)\n        const buffer = await i2c.read(0x30, 4);\n        const x = buffer.readInt16LE(0);\n        const y = buffer.readInt16LE(2);\n        console.log({x, y});\n\n        // read as hex-string for whatever\n        const hexString = await i2c.readAsHex(0x30, 4);\n        console.log({hexString});\n    } catch (err) {\n        console.log('Error', err)\n    }\n})();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzebrajaeger%2Fremote-i2c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzebrajaeger%2Fremote-i2c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzebrajaeger%2Fremote-i2c/lists"}