{"id":21077390,"url":"https://github.com/ros2jsguy/node-blink1-async","last_synced_at":"2025-03-14T04:10:47.119Z","repository":{"id":94000425,"uuid":"374877965","full_name":"ros2jsguy/node-blink1-async","owner":"ros2jsguy","description":"Asynchronous TypeScript api for controlling blink(1) USB LED devices. Based on the node-blink1 package.","archived":false,"fork":false,"pushed_at":"2021-06-30T04:40:52.000Z","size":299,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-30T00:10:55.164Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ros2jsguy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-08T04:15:21.000Z","updated_at":"2021-06-30T04:40:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"e0ad56bd-b90f-442c-9027-7e7aa9ae5464","html_url":"https://github.com/ros2jsguy/node-blink1-async","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"a52439c7b48e2aa6aaeef6a30ff641262984767b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2jsguy%2Fnode-blink1-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2jsguy%2Fnode-blink1-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2jsguy%2Fnode-blink1-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2jsguy%2Fnode-blink1-async/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ros2jsguy","download_url":"https://codeload.github.com/ros2jsguy/node-blink1-async/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243521281,"owners_count":20304186,"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-11-19T19:36:18.173Z","updated_at":"2025-03-14T04:10:47.095Z","avatar_url":"https://github.com/ros2jsguy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-blink1-async\n\nProgrammatically controlling [blink(1) USB LED devices](https://blink1.thingm.com/) is simple using **node-blink1-async**. Much of the API is asynchronous (i.e., returns Promise that you can await on) and fully [documented](https://ros2jsguy.github.io/node-blink1-async/). This module has been tested on Mac, Windows 10, and Ubuntu Linux on a Raspberry Pi 4. \n\n![blink(1) USB led on raspberry pi 4](docs/blink1-raspi.jpg \"blink(1) USB led on raspberry pi 4\")\n\n\nIf you perfer a JS callback style API consider [node-blink1](https://www.npmjs.com/package/node-blink1). \n\n\n# Prerequisites\n* Node (v12+)\n* blink(1) USB led device\n\nEnsure your blink(1) is fully functional using the [blink(1) utilities](https://blink1.thingm.com/downloads/). \n\n# Install\n```\nnpm install https://github.com/ros2jsguy/node-blink-async\n```\n\n## Linux Users\nYour device may need libusb installed:\n```\nsudo apt install libusb-1.0-0\n```\n\nSee node-hid's [instructions for compiling from source](https://github.com/node-hid/node-hid#compiling-from-source)\nYou may find the 51-blink1.rules file useful in your device configuration process. \n\n# TypeScript Example\n```\nimport {Blink1, Blink1_LEDN, BlinkRate} from '@ros2jsguy/node-blink1-async';\n\nasync function example() {\n  // list all blink(1) devices\n  console.log('devices; ', Blink1.devices());\n\n  // output the version info of the default blink(1) device\n  let blink1: Blink1 = new Blink1();\n  console.log(\"version: \" , await blink1.version() );\n\n  console.log('set color: red', await blink1.setRGB(255));\n  console.log('read rgb: ', await blink1.rgb(Blink1_LEDN.LEDA));\n  await Blink1.delay(2000);\n\n  console.log('Blink green at VERY_FAST rate (100 ms) for 5 seconds');\n  await blink1.blink(0, 255, 0, BlinkRate.VERY_FAST);\n  await Blink1.delay(5000);\n  \n  console.log('Blink blue at SLOW rate (1000 ms) for 5 seconds');\n  await blink1.blink(0, 0, 255, BlinkRate.SLOW);\n  await Blink1.delay(5000);\n\n  console.log('Show solid yellow for 5 seconds');\n  await blink1.blink(255, 255, 0);\n  await Blink1.delay(5000);\n\n  // turn off the blink(1) output\n  await blink1.off();\n\n  // access the display pattern at line-1\n  console.log('Color pattern (line-1):', await blink1.readPatternLine(1));\n\n  // clear the memory of all display patterns.\n  console.log('Clearing pattern');\n  await blink1.clearPattern();\n\n  // confirm that display patterns are cleared\n  console.log('Color pattern (line-1):', await blink1.readPatternLine(1));\n\n  // close and release the blink(1) device\n  await blink1.close();\n\n  console.log('completed');\n}\n```\n\n# Developer Notes\nI develop mostly in TypeScript and prefer using modern JS features when I have the option. \nWorking directly with the node-blink1 package which has been around for awhile, felt too\nretro for my liking, e.g., no jsdoc, callback-based api... \nI mean no disrespect to the node-blink1 author(s) who's priority \nfor backward compatibility supercedes breaking the package just to use a new\nwizbang language feature. While developing a robot using TypeScript \non a Raspi4 I wanted to integrate an old Blink1 led from my kit\ninto the design. That led me to creating this package that makes it easier to \nto asynchronously control a Blink1 LED from TypeScript.\n\n# Credits\nThis package uses the [node-blink1](https://www.npmjs.com/package/node-blink1) package to perform the low level control of Blink1 devices","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fros2jsguy%2Fnode-blink1-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fros2jsguy%2Fnode-blink1-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fros2jsguy%2Fnode-blink1-async/lists"}