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

maestro-servo-controller

v1.0.4

Published

Maestro Servo Controller

Downloads

7

Readme

Micro Maestro 6-Channel + Node.js + RaspberryPi

Install

npm install maestro-servo-controller

Platforms

Typical device names for:

Linux

  • RaspberryPi: /dev/ttyACM0
  • Ubuntu: /dev/ttyAMA0

Mac

  • Mac: /dev/cu.usbmodem00115481

NOTE: The trailing numbers in the device path name are likely to be different for your specific system. To discover the exact device path name for your system, simply run ls /dev/ before connecting the device to your host computer. Next, connect your device to the host machine. Now, run ls /dev/ once again, and the newest device paths belong to your maestro device. Of the newly visible device path names, the one with the lower number is the device path name to use.

Usage

var servo = require('maestro-servo-controller');

Connect

To connect to the maestro device through the serial connection, use the following command with your device's path name:

//--------------------------------------------------------------------
//  connect(device_path)
//    - device_path: the path to the Maestro device
//
//  NOTE: The Maestro's serial mode must be set to "USB Dual Port".
//--------------------------------------------------------------------
servo.connect('/dev/cu.usbmodem00115481');

Set Speed

To set a specific servo's speed, use the following command:

//--------------------------------------------------------------------
//  setSpeed(channel, speed)
//    - channel: servo number
//    - speed: servo speed
//--------------------------------------------------------------------
servo.setSpeed(0, 25);

Set Acceleration

To set a specific servo's acceleration, use the following command:

//--------------------------------------------------------------------
//  setAccel(channel, accel)
//    - channel: servo number
//    - accel: servo acceleration
//--------------------------------------------------------------------
servo.setAccel(0, 2);

Set Target

Here is where things get truly interesting! To set a specific servo's target position, causing the servo shaft to progress to a desired position, use the following command:

//--------------------------------------------------------------------
//  setTarget(channel, target)
//    - channel: servo number
//    - target: the target servo posistion in quarter-microseconds
//
//  servo protections:
//    - servo min: 2000 (500us)
//    - servo max: 10000 (2500us)
//
//  for reference:
//    - servo center: ~6000 (1500us)
//--------------------------------------------------------------------
servo.setTarget(0, 6000);

Get Position

If you need to retrieve the current position of a specific servo, use the following command:

//--------------------------------------------------------------------
//  getPosition(channel)
//    - channel: servo number
//
//  returns: an integer representing the servo's current position;
//            is a quarter-microsecond value like the target value
//--------------------------------------------------------------------
console.log('Servo position:', servo.getPosition(0));

Disconnect

To disconnect to the maestro device attached to your computer's serial connection, use the following command:

//--------------------------------------------------------------------
//  disconnect()
//    - close connection to Maestro device
//--------------------------------------------------------------------
servo.disconnect();

References