Camilo Londoño / DebouncedIn

Dependents:   Prueba_Ascensor Ascensor NewAscensor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DebouncedIn.h Source File

DebouncedIn.h

00001 #include "mbed.h"
00002  
00003     class DebouncedIn {
00004         public:      
00005              DebouncedIn(PinName in);
00006  
00007              int read (void);
00008              operator int();
00009               
00010              int rising(void);
00011              int falling(void);
00012              int steady(void);
00013               
00014         private :    
00015                // objects
00016                DigitalIn _in;    
00017                Ticker _ticker;
00018  
00019                // function to take a sample, and update flags
00020                void _sample(void);
00021  
00022                // counters and flags
00023                int _samples;
00024                int _output;
00025                int _output_last;
00026                int _rising_flag;
00027                int _falling_flag;
00028                int _state_counter;
00029  
00030     };