adc-pi-gpio
Using an ADC with a Pi
Last updated 7 years ago by xavier.seignard .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install adc-pi-gpio 
SYNC missed versions from official npm registry.

adc-pi-gpio Build Status

Node.js Bit banging communication between ADC and the Raspberry Pi.

Largely inspired by ladyada's script: https://gist.github.com/ladyada/3151375.

Usage

See https://github.com/xseignard/adcPi/blob/master/demo/app.js

API

ADC()

ADC class, that represents an instance of an ADC.

Below is a code snippet that shows the configuration possibilities.

The opts object is optional. And each key inside it too.

The values shown there are the defaults fallback.

var ADC = require('adc-pi-gpio'),
  opts = {
    tolerance : 2,
    interval : 300,
    channels : [0],
    SPICLK: 12,
    SPIMISO: 16,
    SPIMOSI: 18,
    SPICS: 22
  };
var adc = new ADC(opts);

ADC.init()

Init the pins that are used by the ADC and start reading on the defined ADC channels.

ADC.close()

Close the pins used by the ADC.

ADC.read(channel:Number, callback:function())

Read the value of the given ADC channel.

Current Tags

  • 0.0.2                                ...           latest (7 years ago)

2 Versions

  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |