{"id":14978088,"url":"https://github.com/jcane86/motor-hat","last_synced_at":"2026-05-18T01:07:16.693Z","repository":{"id":57303106,"uuid":"81257030","full_name":"jcane86/motor-hat","owner":"jcane86","description":"Node Module to control Adafruits MotorHAT for the RaspberryPi","archived":false,"fork":false,"pushed_at":"2026-05-17T23:20:41.000Z","size":1347,"stargazers_count":28,"open_issues_count":2,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-05-18T00:22:12.987Z","etag":null,"topics":["javascript","node","node-js","nodejs","raspberry","raspberry-pi","raspberry-pi-3","raspberrypi","stepper","stepper-library","stepper-motor"],"latest_commit_sha":null,"homepage":" https://jcane86.github.io/motor-hat/","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/jcane86.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":"2017-02-07T21:38:42.000Z","updated_at":"2026-05-17T23:19:24.000Z","dependencies_parsed_at":"2022-09-02T06:35:25.163Z","dependency_job_id":null,"html_url":"https://github.com/jcane86/motor-hat","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/jcane86/motor-hat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcane86%2Fmotor-hat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcane86%2Fmotor-hat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcane86%2Fmotor-hat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcane86%2Fmotor-hat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcane86","download_url":"https://codeload.github.com/jcane86/motor-hat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcane86%2Fmotor-hat/sbom","scorecard":{"id":510993,"data":{"date":"2025-08-11","repo":{"name":"github.com/jcane86/motor-hat","commit":"042dad4c483bc2581f615d66c85f54725b43f572"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"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":"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":0,"reason":"Found 1/13 approved changesets -- score normalized to 0","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":"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":"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:0","Info: FSF or OSI recognized license: MIT License: LICENSE: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 26 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-20T00:32:49.900Z","repository_id":57303106,"created_at":"2025-08-20T00:32:49.901Z","updated_at":"2025-08-20T00:32:49.901Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33161411,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"ssl_error","status_checked_at":"2026-05-17T22:39:10.741Z","response_time":107,"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":["javascript","node","node-js","nodejs","raspberry","raspberry-pi","raspberry-pi-3","raspberrypi","stepper","stepper-library","stepper-motor"],"created_at":"2024-09-24T13:56:50.885Z","updated_at":"2026-05-18T01:07:16.688Z","avatar_url":"https://github.com/jcane86.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🏁 motor-hat 🎩\n\n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url] [![semantic-release][semrel-image]][semrel-url] [![Commitizen friendly][commitizen-image]][commitizen-url]  [![Gitter badge](https://badges.gitter.im/motor-hat.png)](https://gitter.im/motor-hat)\n\n\u003e Node Module to control Adafruit's MotorHAT for the Raspberry Pi [http://jcane86.github.io/motor-hat](http://jcane86.github.io/motor-hat)\n\n## Requirements\n\nNode.js \u003e= 18\n\n## Installation \u0026 Basic Usage\n\n```sh\n$ npm install --save motor-hat\n```\n```js\nvar motorHat = require('motor-hat')({steppers: [{ W1: 'M1', W2: 'M2' }]}).init();\nmotorHat.steppers[0].setSpeed({pps:100});\nmotorHat.steppers[0].step('back', 2048, (err, result) =\u003e {\n  if (err) return console.log('Oh no, there was an error', err);\n  console.log(`Did ${result.steps} steps ${result.dir} in ${result.duration/1000} seconds. I had to retry ${result.retried} steps because you set me up quicker than your poor board can handle.`); \n});\n```\n\n## DOCS\n\n* See the full api here: [http://jcane86.github.io/motor-hat](http://jcane86.github.io/motor-hat)\n* See it on GitHub here: [http://github.com/jcane86/motor-hat](http://github.com/jcane86/motor-hat)\n\n## Notes about 2.0\n\nSome changes will need to be made to transition to the async version of the library in 2.0:\n\nMain library:\n* Instance needs to be init()'d\n* Servo and Stepper instances exposed in servos and steppers arrays are already init()'d.\n\nDC Motors: \n* Methods are now async, and need a callback as last parameter.\n* Old Sync methods remain, just call them as stopSync(), etc..\n* Instance needs to be init()'d\n\nServo Motors:\n* No changes, everything is still sync (I didn't feel it was necessary, feel free to open an issue or send a PR otherwise).\n\nStepper Motors:\n* Most methods already had the Sync suffix. Only setFrequency is now setFrequencySync.\n* Async methods added.\n* Release and current methods added (actually in 1.3).\n* Instance needs to be init()'d\n\n## Advanced usage\n\n```js\n// get a motor-hat instance with the following initialized:\n// * a non-default I2C address for the motor hat (default is 0x6F)\n// * a stepper with winding one on 'M1' and winding two on 'M2' ports\n// * a dc motor on port 'M4'\n// * a servo on channel 0\n// * a servo on channel 14\nlet spec = {\n    address: 0x60,\n    steppers: [{ W1: 'M1', W2: 'M2' }],\n    dcs: ['M4'],\n    servos: [0,14]\n};\nvar motorHat = require('motor-hat')(spec);\n\n// Since MotorHat 2.0, the instance needs to be initialized.\n// This is to enable async initialization, feel free to open an issue if this is a pain.\nmotorHat.init();\n\n// For steppers, set speed in rpm or pps (pulses per second) or sps (steps per second).\n// To set it in rpm, set you steps/rev first (default 200)\n// If you set it in pps, the speed will not be constant for different styles or number of microsteps.\nmotorHat.steppers[0].setSteps(2048);\nmotorHat.steppers[0].setSpeed({rpm:5});\n\n// Move the motor one full turn fwds synchronously, one back async.\n// step[Sync] and oneStep[Sync] take number of steps as input, \n// depending on selected style. To do 2048 full steps fwd (sync), 2048 back (async):\nmotorHat.steppers[0].stepSync('fwd', 2048);\nmotorHat.steppers[0].step('back', 2048, function(err, result) {\n  if (err) {\n    console.log('Oh no, there was an error');\n  } else {\n    // Move on..\n  }\n});\n```\n\n## Further configuration\n```js\n// Supported syles are 'single', 'double' (default), 'interleaved', and 'microstep'\nmotorHat.steppers[0].setStyle('microstep');\n// Supported number of microsteps are 8 and 16 (8 by default)\nmotorHat.steppers[0].setMicrosteps(16);\n// step[Sync] and oneStep[Sync] take number of steps/halfsteps/microsteps as input, \n// depending on selected style. To do 16 microsteps fwd:\nmotorHat.steppers[0].stepSync('back', 16);\n// Set current at 50% to avoid overheating or to run at lower torques\nmotorHat.steppers[0].setCurrent(0.5);\n// Release motor after moving it to avoid overheating or to let it move freely.\nmotorHat.steppers[0].release((err) =\u003e !err \u0026\u0026 console.log(\"IT'S FREE!!\"));\n\n\n// Calibrate the servo output. Pass in PWM frequency, position 0 pulse duration in ms,\n// position 100 pulse duration in ms.\nmotorHat.servos[0].calibrate(50, 1, 2);\n// Move to position 0\nmotorHat.servos[0].moveTo(0);\n// Move to position 100\nmotorHat.servos[0].moveTo(100);\n\n\n// Start dc motor forward (by default at 100% speed)\nmotorHat.dcs[0].runSync('fwd');\n// Set DC motor speed to 50%\nmotorHat.dcs[0].setSpeedSync(50);\n// reverse the dc motor to back direction\nmotorHat.dcs[0].runSync('back');\n// stop the dc motor\nmotorHat.dcs[0].stopSync();\n```\n\n## As seen in\nSome of our friends made cool stuff using motor-hat. Drop us a PR to add your project to this list.\n\n - [@joeljameswatson]( https://github.com/joeljameswatson ) : Laser Mandala, a really cool remote controlled lights show ([joeljameswatson/laser-mandala]( https://github.com/joeljameswatson/laser-mandala ))\n## License\n\nMIT © [J. Cane](https://www.github.com/jcane86)\n\n\n[npm-image]: https://badge.fury.io/js/motor-hat.svg\n[npm-url]: https://npmjs.org/package/motor-hat\n[travis-image]: https://travis-ci.org/jcane86/motor-hat.svg?branch=master\n[travis-url]: https://travis-ci.org/jcane86/motor-hat\n[daviddm-image]: https://david-dm.org/jcane86/motor-hat.svg?theme=shields.io\n[daviddm-url]: https://david-dm.org/jcane86/motor-hat\n[coveralls-image]: https://img.shields.io/coveralls/jcane86/motor-hat/master.svg\n[coveralls-url]: https://coveralls.io/github/jcane86/motor-hat?branch=master\n[semrel-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semrel-url]: https://github.com/semantic-release/semantic-release\n[commitizen-image]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\n[commitizen-url]: http://commitizen.github.io/cz-cli/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcane86%2Fmotor-hat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcane86%2Fmotor-hat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcane86%2Fmotor-hat/lists"}