Giter VIP home page Giter VIP logo

adafruit-pca9685's Introduction

adafruit-pca9685

This is a node.js library for driving the Adafruit 12 bit 16 channel PWM Driver based on the PCA9685 with the Raspberry Pi

Installation:

npm install adafruit-pca9685 

Optionally, get it from github and run npm install.

In your node.js file just require the library:

var makePwm = require( "adafruit-pca9685" );

This returns a constructor which you can now use to create a pwm instance using:

var pwm = makePwm();

The constructor can also be called with an argument map object. The map below shows defaults

 {
    "freq": "50",   // frequency of the device
    "correctionFactor": "1.0", // correction factor - fine tune the frequency 
    "address": "0x40", // i2c bus address
    "device": '/dev/i2c-1', // device name
    "debug": <null> // adds some debugging methods if set 
  }

The created pwm object has four methods

pwm.setFrequency(freq, correctionFactor);
pwm.setPwm(channel, on, off);
pwm.setPulse(channel, pulse);
pwm.stop();

A demo web application is in the demo folder

Remember: You must run your application as root

Acknowledgements

Some of the design for this module is is based on the [Adafruit python Code Library] (https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git)

Here is a growing collection of libraries and example python scripts for controlling a variety of Adafruit electronics with a Raspberry Pi

In progress!

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried, Kevin Townsend and Mikey Sklar for Adafruit Industries. BSD license, all text above must be included in any redistribution

To download, we suggest logging into your Pi with Internet accessibility and typing: git clone https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git

Additional inspiration came from the pi4j project and the implementation of adafruit-i2c-pwm-driver node module.

adafruit-pca9685's People

Contributors

johntreacy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

adafruit-pca9685's Issues

multiple pwm instances break functionality

If you chain PCA9685s, creating multiple instances of a pwm object results in buggy behavior (eg with two chained banks, bank #2 gets distorted PWM values, bank #1 doesn't work at all). Not sure if this is as intended, but thought it worthwhile to mention.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.