adc_read

(FW >= 1.0)

adc_read - read onboard ADC channel

Description

int adc_read( int channel )
Read onboard ADC channel number

Parameters

channel

Channel number.  On the Wattmon board, channel 0 is attached to the voltage divider to measure battery voltage.  Chanel 1 is attached to two diodes and can be used to measure board temperature.  Channel 2-5 can be used to measure other sensors by attaching them to the onboard io connector.

Return Value

ADC value (10-bit), 0-1024

Examples

<? 

 $v=adc_read(0);
$v=floatval($_GLOBALS['v_adc_mul'])*(floatval($v)+floatval($_GLOBALS['v_adc_offset']));
?>