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

serialservo

v0.1.5

Published

allows calls to serial servo controller using 3-byte protocol

Downloads

17

Readme

serialservo

This module will allow for using the serial servo controller via a serial port.

If you don't have a serial port on your machine you, this will add a mock serial port for you so you can still run your test. Because this port just uses the write method of the serial port, the mock serial port just uses that.

Install

npm install

Testing

npm install
npm install istanbul -g
npm test
npm run coverage

Typical Usage

These have default options for the portName = /dev/ttyUSB0, and baudrate = 9600, enabledLogging = true.

var SerialServo = require("serialservo");
var ssc = new SerialServo(); // default
ssc.move(0,100); // move pin 0 to position 100
ssc.nav(100,100); // send multiple bytes to pins 0 and 1 to positions 100
ssc.timedMove(0,100,100); // send move pin 0 to position 100 for 100ms, then back to 127
ssc.timedNav(100,100,100); // send multiple bytes to pins 0 and 1 to position 100 for 100ms, then back to 127

Serial Servo Controller Protocol

This npm utilizes the 3-byte protocol popularized by the Scott Edwards Mini-SSC2. You can view the entire PDF in the docs/ directory of this project.

The protocol itself consist of 3 bytes in the format [255,pin,pos]

  • pin - generally from 0-7 or 0-31 based on the size of your controller.
  • pos - from 0-255, where 0 would be 0 degrees and 255 would coorespond to 180 degrees on a 0-180 degree servo.

Example Servo Controllers

Just google the term "serial servo controller" you will find a lot of products.

You can visit sites:

  • http://www.pololu.com/
  • http://www.lynxmotion.com/
  • https://www.sparkfun.com

Cusomized Usage

Alternatively you can add options to the serialservo constructor for the port name or the serial port parameters.

var SerialServo = require("serialservo");
var ssc = new SerialServo({
    portName: "/dev/tty1",
    serialPortOptions: {baudrate:19200},
    enableLogging: false
    });
ssc.move(0,100); // move pin 0 to position 100

License

The MIT License (MIT)

Copyright (c) 2014-16 Scott Preston

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.