{"id":13521395,"url":"https://github.com/rwaldron/particle-io","last_synced_at":"2025-12-18T03:54:07.274Z","repository":{"id":13428384,"uuid":"16117158","full_name":"rwaldron/particle-io","owner":"rwaldron","description":"Particle/Spark Core/Photon IO Plugin for Johnny-Five","archived":false,"fork":false,"pushed_at":"2023-08-27T10:15:33.000Z","size":674,"stargazers_count":173,"open_issues_count":16,"forks_count":30,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-10-20T21:37:12.971Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://johnny-five.io","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/rwaldron.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2014-01-21T20:00:30.000Z","updated_at":"2024-05-03T15:07:02.000Z","dependencies_parsed_at":"2023-12-09T10:43:36.525Z","dependency_job_id":null,"html_url":"https://github.com/rwaldron/particle-io","commit_stats":{"total_commits":220,"total_committers":12,"mean_commits":"18.333333333333332","dds":0.4181818181818182,"last_synced_commit":"08945e5bbaa2029b441833ea6d30ef420e9d54f4"},"previous_names":["rwaldron/spark-io"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rwaldron/particle-io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwaldron%2Fparticle-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwaldron%2Fparticle-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwaldron%2Fparticle-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwaldron%2Fparticle-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwaldron","download_url":"https://codeload.github.com/rwaldron/particle-io/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwaldron%2Fparticle-io/sbom","scorecard":{"id":791237,"data":{"date":"2025-08-11","repo":{"name":"github.com/rwaldron/particle-io","commit":"08945e5bbaa2029b441833ea6d30ef420e9d54f4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":1,"reason":"Found 3/25 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE-MIT:0","Info: FSF or OSI recognized license: MIT License: LICENSE-MIT:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T07:36:42.245Z","repository_id":13428384,"created_at":"2025-08-23T07:36:42.245Z","updated_at":"2025-08-23T07:36:42.245Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27790709,"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","status":"online","status_checked_at":"2025-12-18T02:00:09.725Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-08-01T06:00:33.864Z","updated_at":"2025-12-18T03:54:07.251Z","avatar_url":"https://github.com/rwaldron.png","language":"JavaScript","funding_links":[],"categories":["Libraries and Plugins"],"sub_categories":["IO Compatibility Plugins"],"readme":"# Particle-io\n\n[![Build Status](https://travis-ci.org/rwaldron/particle-io.png?branch=master)](https://travis-ci.org/rwaldron/particle-io)\n\nParticle-io is a Firmata-compatibility IO class for writing node programs that interact with [Particle devices](http://docs.particle.io/) (formerly Spark). Particle-io was built at [Bocoup](http://bocoup.com/)\n\n### Getting Started\n\nIn order to use the particle-io library, you will need to load the special\n[voodoospark](https://github.com/voodootikigod/voodoospark) firmware onto your\ndevice. We recommend you review [VoodooSpark's Getting Started](https://github.com/voodootikigod/voodoospark#getting-started) before continuing.  There is also a screencast of how to get started: [Get Your Motor Running: Particle Photon and Johnny Five](https://www.youtube.com/watch?v=jhism2iqT7o).\n\nWe also recommend storing your Particle token and device ID in a dot file so they can be accessed as properties of `process.env`. Create a file in your home directory called `.particlerc` that contains: \n\n```sh\nexport PARTICLE_TOKEN=\"your particle token\"\nexport PARTICLE_DEVICE_ID=\"your device id\"\n```\n\nThen add the following to your dot-rc file of choice:\n\n```sh\nsource ~/.particlerc\n```\n\nEnsure your host computer (where you're running your Node.js application) and the Particle are on the same local network.\n\n### Blink an Led\n\n\nThe \"Hello World\" of microcontroller programming:\n\n```js\nvar Particle = require(\"particle-io\");\nvar board = new Particle({\n  token: process.env.PARTICLE_TOKEN,\n  deviceId: process.env.PARTICLE_DEVICE_ID\n});\n\nboard.on(\"ready\", function() {\n  console.log(\"Device Ready..\");\n  this.pinMode(\"D7\", this.MODES.OUTPUT);\n\n  var byte = 0;\n\n  // This will \"blink\" the on board led\n  setInterval(function() {\n    this.digitalWrite(\"D7\", (byte ^= 1));\n  }.bind(this), 500);\n});\n```\n\n#### Troubleshooting\n\nIf your board is connecting, but the `board.on(\"ready\", ...)` event is not occuring, ensure the wifi network you are connected to allows for direct TCP client/server sockets (this form of communication is often blocked by public wifi networks).\n\n### Johnny-Five IO Plugin\n\nParticle-io can be used as an [IO Plugin](https://github.com/rwaldron/johnny-five/wiki/IO-Plugins) for [Johnny-Five](https://github.com/rwaldron/johnny-five):\n\n```js\nvar five = require(\"johnny-five\");\nvar Particle = require(\"particle-io\");\nvar board = new five.Board({\n  io: new Particle({\n    token: process.env.PARTICLE_TOKEN,\n    deviceId: process.env.PARTICLE_DEVICE_ID\n  })\n});\n\nboard.on(\"ready\", function() {\n  console.log(\"Device Ready..\");\n  var led = new five.Led(\"D7\");\n  led.blink();\n});\n```\n\nSee the above [Troubleshooting](#troubleshooting) section if your board is connecting, but the `board.on(\"ready\", ...)` event is not occuring.\n\n### API\n**Constructor**\nThe Particle component can be connected using one of three mechanisms: `deviceId`, `deviceName`, or `host`/`port`.  Both `deviceId` and `deviceName` require an additional `token` so that the host and port of the device can be retrieved from the Particle cloud.\n\nExample:\n```js\nvar Particle = require(\"particle-io\");\n\nvar byId = new Particle({\n  token: process.env.PARTICLE_TOKEN,\n  deviceId: process.env.PARTICLE_DEVICE_ID\n});\n\nvar byName = new Particle({\n  token: process.env.PARTICLE_TOKEN,\n  deviceName: process.env.PARTICLE_DEVICE_NAME || \"crazy_pickle\"\n});\n\nvar byIp = new Particle({\n  host: '192.168.0.111',\n  port: 48879\n});\n```\n\n**device properties**\nYou can get the information that the component knows about the chip with some read-only device properties.  This is useful for retrieving the IP address of the Particle so that you can swith over to `host`/`port` mode if necessary.\n\nThe available properties are:\n- `deviceId`: The ID of the device\n- `deviceName`: The name of the device\n- `deviceIp`: The IP address of the device on the local network\n- `devicePort`: The port the device is listening on for connections\n\nExample:\n```js\nvar Particle = require(\"particle-io\");\n\nvar board = new Particle({\n  token: process.env.PARTICLE_TOKEN,\n  deviceName: process.env.PARTICLE_DEVICE_Name || \"crazy_pickle\"\n});\n\nboard.on(\"ready\", function() {\n  console.log(\n    \"Connected to \" + board.deviceName + \n    \" (\" + board.deviceId + \") \" +\n    \"at \" + board.deviceIp + \":\" + board.devicePort\n  );\n});\n```\n\n**MODES**\n\n\u003e The `MODES` property is available as a Particle instance property:\n\n```js\nvar board = new Particle(...);\nboard.MODES;\n```\n- INPUT: 0\n- OUTPUT: 1\n- ANALOG: 2\n- PWM: 3\n- SERVO: 4\n\n\n\n**pinMode(pin, MODE)**\n\n\u003e Set a pin's mode to any one of the MODES. \n\nExample:\n```js\nvar board = new Particle(...);\n\nboard.on(\"ready\", function() {\n\n  // Set digital pin 7 to OUTPUT:\n  this.pinMode(\"D7\", this.MODES.OUTPUT);\n\n  // or just use the integer:\n  this.pinMode(\"D7\", 1);\n\n});\n```\n\nPWM Support (Servo support is also limited to these pins): \n- Core pins: A0, A1, A4, A5, A6, A7, D0, D1.\n- Photon pins: A4, A5, D0, D1, D2, D3\n- P1 pins: A4, A5, D0, D1, D2, D3\n\n\n**digitalWrite(pin, value)**\n\n\u003e Sets the pin to `1` or `0`, which either connects it to 3.3V (the maximum voltage of the system) or to GND (ground).\n\nExample:\n```js\nvar board = new Particle(...);\n\nboard.on(\"ready\", function() {\n\n  // This will turn ON the on-board LED\n  this.digitalWrite(\"D7\", 1);\n\n  // OR...\n\n  // This will turn OFF the on-board LED\n  this.digitalWrite(\"D7\", 0);\n\n});\n```\n\n**analogWrite(pin, value)**\n\n\u003e Sets the pin to an 8-bit value between 0 and 255, where 0 is the same as LOW and 255 is the same as HIGH. This is sort of like sending a voltage between 0 and 3.3V, but since this is a digital system, it uses a mechanism called Pulse Width Modulation, or PWM. You could use analogWrite to dim an LED, as an example. PWM is available on D0, D1, A0, A1, A4, A5, A6 and A7.\n\n\nExample:\n```js\nvar board = new Particle(...);\n\nboard.on(\"ready\", function() {\n\n  // Set an LED to full brightness\n  this.analogWrite(\"A7\", 255);\n\n  // OR...\n\n  // Set an LED to half brightness\n  this.analogWrite(\"A7\", 128);\n\n});\n```\n\n**servoWrite(pin, value)**\n\n\u003e Sets the pin to a value between 0 and 180, where the value represents degrees of the servo horn. The value is converted to a PWM signal. PWM is available on D0, D1, A0, A1, A4, A5, A6 and A7.\n\nExample:\n```js\nvar board = new Particle(...);\n\nboard.on(\"ready\", function() {\n\n  // Move a servo to 90 degrees\n  this.servoWrite(\"D0\", 90);\n\n});\n```\n\n\n**digitalRead(pin, handler)** Setup a continuous read handler for specific digital pin (D0-D7).\n\n\u003e This will read the digital value of a pin, which can be read as either HIGH or LOW. If you were to connect the pin to a 3.3V source, it would read HIGH (1); if you connect it to GND, it would read LOW (0).\n\nExample:\n```js\nvar board = new Particle(...);\n\nboard.on(\"ready\", function() {\n\n  // Log all the readings for D1\n  this.digitalRead(\"D1\", function(data) {\n    console.log(data);\n  });\n\n});\n```\n\n\n**analogRead(pin, handler)** Setup a continuous read handler for specific analog pin (A0-A7). Use with all analog sensors\n\n\nExample:\n```js\nvar board = new Particle(...);\n\nboard.on(\"ready\", function() {\n\n  // Log all the readings for A1\n  this.analogRead(\"A1\", function(data) {\n    console.log(data);\n  });\n\n});\n```\n\n\n## License\nSee LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwaldron%2Fparticle-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwaldron%2Fparticle-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwaldron%2Fparticle-io/lists"}