npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-motor-shield

v1.3.2

Published

Node implementation of SBC Shop's Motor Shield library

Downloads

9

Readme

Node Motor Shield

Node-based implementation of SBCShop's Python MotorShield library.

Implementation Status

  • Class Motor :heavy_check_mark:

  • Class LinkedMotors :heavy_check_mark:

  • Class Stepper :heavy_check_mark:

  • Class Sensor :x:

  • Class Arrow :heavy_check_mark:

  • Test_Motor :heavy_check_mark:

  • Stepper_Test :heavy_check_mark:

  • GUI_Motor_Shield :x: not currently planned

Installation

npm install --save node-motor-shield

Alternatively, download the package and include PiMotor.js in your project's directory.

Usage

Include the library like so:

// From npm:
const PiMotor = require('node-motor-shield');
// From PiMotor.js:
const PiMotor = require('./PiMotor.js');

Instance the class you want and use it to control the motors.

const motor1 = new PiMotor.Motor('MOTOR1', 1);

motor1.forward(75); // Drives motor #1 forward at 75% speed.

Arguments are the same as the Python MotorShield library. See Test_Motor.js and Stepper_Test.js for more examples, and the MotorShield Python Docs for more information on how to use the library.

Differences and Notes

Effort has been made to ensure this repository behaves identically to the Python version. Differences between the libraries are designed to add minor functionality without sacrificing compatibility.

  • All Classes

    • All class methods return this so they can be chained.
  • Class Motor

    • forward() and reverse() may be called without a speed argument, which will cause the speed to default to 100.
    • test() may be called without an argument, which acts as a toggle to the testmode state.
  • Class LinkedMotors

    • As in the Motor class, forward() and reverse() may be called without the speed argument, which will default the speed to 100.
  • Motor Test

    • ~~For now, the test only runs once, until I can figure out how to make it loop continuously, which will depend on making it block the next iteration until the last one finishes. JS sucks at things like that.~~ This has been fixed in version 1.3.0
  • Class Stepper

    • NOTE: Delay times are in full seconds to align with the original library's API.
  • Stepper Test

    • ~~As with Motor Test, only runs once.~~ This has been fixed in version 1.3.0
    • Added a stop call to the function so the motor will stop running after the test.