From 0313d106a0835c44d98998f4e7d773bfaea93240 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 1 Jul 2012 15:09:39 +1000 Subject: [PATCH] ArduBoat: removed use of analogRead() --- ArduBoat/ControllerSailboat.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArduBoat/ControllerSailboat.h b/ArduBoat/ControllerSailboat.h index fa84f9c452..b0bb7cd8d5 100644 --- a/ArduBoat/ControllerSailboat.h +++ b/ArduBoat/ControllerSailboat.h @@ -45,8 +45,8 @@ private: } void autoLoop(const float dt) { //_board->debug->printf_P(PSTR("cont: ch1: %f\tch2: %f\n"),_board->rc[ch_sail]->getRadioPosition(), _board->rc[ch_str]->getRadioPosition()); - float windDir = -.339373*analogRead(1)+175.999; - + static AP_AnalogSource_Arduino wind_pin(1); + float windDir = -.339373*wind_pin.read_average()+175.999; // neglects heading command derivative float steering = -pidStr.update(_guide->getHeadingError(), -_nav->getYawRate(), dt);