adc. Object

The adc. object icon.

The adc. object provides access to the onboard analog-to-digital converter (ADC) found on several Tibbo devices.

Devices that support this object offer several ADC channels. You select the desired channel through the adc.num property.

ADC channels are mapped to regular general-purpose I/O (GPIO) lines. For example, on the EM2000 module, channel 0 of the ADC is mapped to GPIO line #40.

After you enable an ADC channel (through adc.enabled), the corresponding GPIO line ceases to work as a regular digital line and becomes an analog input.

Individual acquisitions (measurements) are performed with the adc.getdata method.

Note that the first value returned by adc.getdata should be discarded after booting up the device, enabling a channel, or changing the channel.