00001 // AnalogSetter.h 00002 // 00003 // Setter class that outputs its value to a analog output pin 00004 /// \author Mike McCauley (mikem@open.com.au) 00005 /// 00006 // Copyright (C) 2010 Mike McCauley 00007 // $Id: AnalogSetter.h,v 1.2 2010/06/21 01:33:53 mikem Exp $ 00008 00009 #ifndef AnalogSetter_h 00010 #define AnalogSetter_h 00011 00012 #include "Setter.h" 00013 #include <inttypes.h> 00014 00015 ///////////////////////////////////////////////////////////////////// 00016 /// \class AnalogSetter AnalogSetter.h <AnalogSetter.h> 00017 /// \brief Setter class that sets its value to an analog output pin 00018 /// 00019 class AnalogSetter : public Setter 00020 { 00021 public: 00022 /// \param[in] pin The pin number of the analog output to set 00023 AnalogSetter(uint8_t pin); 00024 00025 /// Set or change the output pin 00026 /// \param[in] pin The Arduino pin to use for output 00027 void setPin(uint8_t pin); 00028 00029 /// Input the value to be used to set the analog output 00030 /// Analog outputs are within the range 0 to 255 for 0.0 to 5.0 V 00031 /// On Duemilanove, output is PWM at approx 1kHz 00032 /// \param[in] value The input value 00033 virtual void input(int value); 00034 00035 /// Called when the source of input data is lost, and the Setter is required to fail in a safe way 00036 virtual void failsafe(); 00037 00038 protected: 00039 00040 private: 00041 /// The analog output pin number 00042 uint8_t _pin; 00043 }; 00044 00045 #endif