The adc
module provides the ADC class which supports analog-digital conversion. Use require('adc')
to access this module.
An instances of ADC
represents a ADC object.
pin
<number>
The pin number which can support ADC function.
Returns: <object>
The return value is ADC
object.
var ADC = require('adc').ADC;var a = new ADC(26);
Returns: <number>
The return value is ADC object.
This method returns the analog value read from the pin. A RangeError
will be thrown if adc.pin
does not support ADC function.
var ADC = require('adc').ADC;var a = new ADC(26);var value = a.read(); // Read the ADC value at the pin 26.
<number>
The pin number which can support ADC function.
The pin number of the ADC object.
var ADC = require('adc').ADC;var a = new ADC(26);console.log(a.pin); // 26