adc_in()


读取ADC的值

Description

int adc_in(int $adc_id [, int $sc = 1])

Parameters

Return Value

相应ADC的输入值(0~4095)

Example

<?php
$in_value = 0;
include "/lib/sd_340.php";
adc_setup(0, 0);          // Setting ADC0 to channel 0
adc_setup(1, 1);          // Setting ADC1 to channel 1
$value_0 = adc_in(0, 1);  // Reading from ADC0
$value_1 = adc_in(1, 50); // Reading from ADC1 (average vale after reading 50 times)
?>

See also