Using an ADC with a Pi
Node.js Bit banging communication between ADC and the Raspberry Pi.
Largely inspired by ladyada's script: https://gist.github.com/ladyada/3151375.
npm install adc-pi-gpio --save
var ADC =config =tolerance : 2interval : 300channels : 0SPICLK: 12SPIMISO: 16SPIMOSI: 18SPICS: 22;var adc = config;process;process;adc;adc;adc;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 =opts =tolerance : 2interval : 300channels : 0SPICLK: 12SPIMISO: 16SPIMOSI: 18SPICS: 22;var adc = opts;
Init the pins that are used by the ADC and start reading on the defined ADC channels.
Close the pins used by the ADC.
Read the value of the given ADC channel.