libraries / Mitov / Mitov_PulseWideModulation.hon commit Added link to project report (97a3ba0)
   1////////////////////////////////////////////////////////////////////////////////
   2//                                                                            //
   3//     This software is supplied under the terms of a license agreement or    //
   4//     nondisclosure agreement with Mitov Software and may not be copied      //
   5//     or disclosed except in accordance with the terms of that agreement.    //
   6//         Copyright(c) 2002-2016 Mitov Software. All Rights Reserved.        //
   7//                                                                            //
   8////////////////////////////////////////////////////////////////////////////////
   9
  10#ifndef _MITOV_PULSE_WIDE_MODULATION_h
  11#define _MITOV_PULSE_WIDE_MODULATION_h
  12
  13#include <Mitov.h>
  14
  15namespace Mitov
  16{
  17        class PulseWideModulation : public Mitov::CommonFilter
  18        {
  19                typedef Mitov::CommonFilter inherited;
  20
  21        protected:
  22                float FValue = 0.0f;
  23
  24        public:
  25                float Period;
  26
  27        protected:
  28                virtual void DoReceive( OpenWire::Data &_Data ) override
  29                {
  30                        FValue = ((OpenWire::ValueData<float>*)&_Data)->Value;
  31/*
  32                        if(((OpenWire::ValueData<bool>*)&_Data)->Value )
  33                                digitalWrite( PinNumber, HIGH );
  34
  35                        else
  36                                digitalWrite( PinNumber, LOW );
  37*/
  38                }
  39
  40        public:
  41                PulseWideModulation( float _period = 20 ) :
  42                        Period( _period )
  43                {
  44                }
  45
  46        };
  47}
  48
  49#endif