2011-12-16 16:18:29 -04:00
|
|
|
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
2011-11-12 23:14:55 -04:00
|
|
|
|
2012-01-27 23:25:47 -04:00
|
|
|
#if defined(ARDUINO) && ARDUINO >= 100
|
|
|
|
#include "Arduino.h"
|
|
|
|
#else
|
|
|
|
#include "wiring.h"
|
|
|
|
#endif
|
2011-11-12 23:14:55 -04:00
|
|
|
#include "AP_AnalogSource_Arduino.h"
|
|
|
|
|
2011-12-16 16:18:29 -04:00
|
|
|
float AP_AnalogSource_Arduino::read(void)
|
2011-11-12 23:14:55 -04:00
|
|
|
{
|
2011-12-16 16:18:29 -04:00
|
|
|
float fullscale = analogRead(_pin);
|
|
|
|
float scaled = _prescale * fullscale;
|
|
|
|
return scaled;
|
2011-11-12 23:14:55 -04:00
|
|
|
}
|