1.2.0 • Published 9 years ago

chain-pwm v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

chain-pwm

Build Status Coverage Status Code Climate Dependency Status

About

Makes PWM calls chainable. That is, usage of the PWM pins on for example an arduino, used from johnny-five.

Installation

npm install --save chain-pwm

Usage

Add 3 steps to a PWM output. One for 255 (max), one for 100 and one for 50.:

var five = require('johnny-five');
var board = new five.Board();
var Pc = require('chain-pwm');

board.on('ready', function() {
  this.pinMode(6, five.Pin.PWM);
  // Constructs a new PWM chainer with pin 6 and the board.
  var p = new Pc(6, board);
  // Begin the output at 255
  p.begin(255)
  // Then write 100, and keep that level for 500ms
  .then(100, 500)
  // Then write 50 and keep that level for 1s
  .then(50, 1000)
  // Actually it is kept indefinitely, since we have no next step.
  // Call start to start the chain.
  .start();
});

API

@todo. But look up there ^^ and see the tests.

1.2.0

9 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago