RCKit
AnalogSetter.h
1 // AnalogSetter.h
2 //
3 // Setter class that outputs its value to a analog output pin
4 /// \author Mike McCauley (mikem@airspayce.com)
5 ///
6 // Copyright (C) 2010 Mike McCauley
7 // $Id: AnalogSetter.h,v 1.3 2018/09/17 23:09:57 mikem Exp mikem $
8 
9 #ifndef AnalogSetter_h
10 #define AnalogSetter_h
11 
12 #include "Setter.h"
13 #include <inttypes.h>
14 
15 /////////////////////////////////////////////////////////////////////
16 /// \class AnalogSetter AnalogSetter.h <AnalogSetter.h>
17 /// \brief Setter class that sets its value to an analog output pin
18 ///
19 class AnalogSetter : public Setter
20 {
21 public:
22  /// \param[in] pin The pin number of the analog output to set
23  AnalogSetter(uint8_t pin);
24 
25  /// Set or change the output pin
26  /// \param[in] pin The Arduino pin to use for output
27  void setPin(uint8_t pin);
28 
29  /// Input the value to be used to set the analog output
30  /// Analog outputs are within the range 0 to 255 for 0.0 to 5.0 V
31  /// On Duemilanove, output is PWM at approx 1kHz
32  /// \param[in] value The input value
33  virtual void input(int value);
34 
35  /// Called when the source of input data is lost, and the Setter is required to fail in a safe way
36  virtual void failsafe();
37 
38 protected:
39 
40 private:
41  /// The analog output pin number
42  uint8_t _pin;
43 };
44 
45 #endif
AnalogSetter::input
virtual void input(int value)
Definition: AnalogSetter.cpp:30
Setter::_failsafeValue
int _failsafeValue
Definition: Setter.h:63
AnalogSetter::AnalogSetter
AnalogSetter(uint8_t pin)
Definition: AnalogSetter.cpp:18
AnalogSetter::setPin
void setPin(uint8_t pin)
Definition: AnalogSetter.cpp:24
AnalogSetter::failsafe
virtual void failsafe()
Called when the source of input data is lost, and the Setter is required to fail in a safe way.
Definition: AnalogSetter.cpp:45
AnalogSetter
Setter class that sets its value to an analog output pin.
Definition: AnalogSetter.h:19
Setter
Virtual base class for classes that receive a value, maybe transform it and then do something with it...
Definition: Setter.h:25