AP_HAL_AVR analog in example: use new constant for board vcc, and vcc not vdd

This commit is contained in:
Pat Hickey 2012-11-28 16:05:37 -08:00 committed by Andrew Tridgell
parent 0c3e59a307
commit 5f48193ea0
1 changed files with 5 additions and 5 deletions

View File

@ -8,21 +8,21 @@ const AP_HAL::HAL& hal = AP_HAL_AVR_APM2;
AP_HAL::AnalogSource* ch0;
AP_HAL::AnalogSource* ch1;
AP_HAL::AnalogSource* vdd;
AP_HAL::AnalogSource* vcc;
void setup (void) {
hal.console->printf_P(PSTR("Starting AP_HAL_AVR::AnalogIn test\r\n"));
ch0 = hal.analogin->channel(0);
ch1 = hal.analogin->channel(1);
vdd = hal.analogin->channel(2);
vcc = hal.analogin->channel(ANALOG_INPUT_BOARD_VCC);
}
void loop (void) {
float meas_ch0 = ch0->read();
float meas_ch1 = ch1->read();
float meas_vdd = vdd->read();
hal.console->printf_P(PSTR("read ch0: %f, ch1: %f, vdd: %f\r\n"),
meas_ch0, meas_ch1, meas_vdd);
float meas_vcc = vcc->read();
hal.console->printf_P(PSTR("read ch0: %f, ch1: %f, vcc: %f\r\n"),
meas_ch0, meas_ch1, meas_vcc);
hal.scheduler->delay(10);
}