2013-09-29 08:33:29 -04:00
|
|
|
//
|
|
|
|
// FILE: AnalogPin.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
2015-03-06 08:26:17 -05:00
|
|
|
// VERSION: 0.1.04
|
2014-12-07 15:11:55 -05:00
|
|
|
// DATE: 2014-10-05
|
2013-09-29 08:33:29 -04:00
|
|
|
// PURPOSE: wrapper class for analogRead
|
|
|
|
// URL:
|
|
|
|
//
|
|
|
|
// Released to the public domain
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef AnalogPin_h
|
|
|
|
#define AnalogPin_h
|
|
|
|
|
|
|
|
#if defined(ARDUINO) && ARDUINO >= 100
|
2014-12-07 15:11:55 -05:00
|
|
|
#include "Arduino.h"
|
2013-09-29 08:33:29 -04:00
|
|
|
#else
|
2014-12-07 15:11:55 -05:00
|
|
|
#include "WProgram.h"
|
2013-09-29 08:33:29 -04:00
|
|
|
#endif
|
|
|
|
|
2015-03-06 08:26:17 -05:00
|
|
|
#define ANALOGPIN_LIB_VERSION "0.1.04"
|
2013-09-29 08:33:29 -04:00
|
|
|
|
|
|
|
class AnalogPin
|
|
|
|
{
|
2014-12-07 15:11:55 -05:00
|
|
|
public:
|
2015-03-06 08:26:17 -05:00
|
|
|
AnalogPin(const uint8_t);
|
2014-12-07 15:11:55 -05:00
|
|
|
|
|
|
|
// noise 0..255; in practice 0..4
|
|
|
|
int read(uint8_t noise = 0);
|
|
|
|
|
|
|
|
// alpha 0..31;
|
|
|
|
int readSmoothed(uint8_t alpha = 0);
|
|
|
|
|
|
|
|
int readPrevious();
|
|
|
|
|
|
|
|
private:
|
2013-09-29 08:33:29 -04:00
|
|
|
uint8_t _pin;
|
2014-12-07 15:11:55 -05:00
|
|
|
int _prevValue;
|
2013-09-29 08:33:29 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// -- END OF FILE --
|