RCKit
ServoSetter.h
1 // ServoSetter.h
2 //
3 // Setter class that outputs its value to a Servo
4 /// \author Mike McCauley (mikem@airspayce.com)
5 ///
6 // Copyright (C) 2010 Mike McCauley
7 // $Id: ServoSetter.h,v 1.3 2018/09/17 23:09:57 mikem Exp mikem $
8 
9 #ifndef ServoSetter_h
10 #define ServoSetter_h
11 
12 #include "Setter.h"
13 
14 class Servo;
15 
16 /////////////////////////////////////////////////////////////////////
17 /// \class ServoSetter ServoSetter.h <ServoSetter.h>
18 /// \brief Setter class that limits its input to between specified min and max values
19 ///
20 class ServoSetter : public Setter
21 {
22 public:
23  /// \param[in] servo The target Servo instance. It is the callers job to attach the Servo to
24  /// the servo output pin
25  ServoSetter(Servo* servo);
26 
27  /// Input the value to be used to set the servo
28  /// Servos are controlled within the range 0 to 180 degrees
29  /// Input values in the range 0-255 are scaled to 0-180
30  /// Values outside that range are limited to 0 and 255
31  /// \param[in] value The input value
32  virtual void input(int value);
33 
34  /// Called when the source of input data is lost, and the Setter is required to fail in a safe way
35  virtual void failsafe();
36 
37 protected:
38 
39 private:
40  Servo* _servo;
41 };
42 
43 #endif
ServoSetter::ServoSetter
ServoSetter(Servo *servo)
Definition: ServoSetter.cpp:13
ServoSetter::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: ServoSetter.cpp:34
ServoSetter
Setter class that limits its input to between specified min and max values.
Definition: ServoSetter.h:20
ServoSetter::input
virtual void input(int value)
Definition: ServoSetter.cpp:19
Setter
Virtual base class for classes that receive a value, maybe transform it and then do something with it...
Definition: Setter.h:25