Alef Sin / PulseDecoder
Embed: (wiki syntax)

« Back to documentation index

pulse_decoder.h File Reference

pulse_decoder.h File Reference

This library provides a simple PWM decoder class. More...

Go to the source code of this file.


Detailed Description

This library provides a simple PWM decoder class.

The approach is based on installing two interrupt routines for the rising and falling edges of an input pin and measuring the time between the two events.

Example:

 #include "mbed.h"
 void main()
 {
     pulse_decoder pulse(D7);

     while(true) {
         printf("Pulse high = %5d low = %5d (us) Period = %5d\n", 
           pulse.get_high_period(), pulse.get_low_period(), 
           pulse.get_high_period() + pulse.get_low_period());  
         wait(.2);
     }    
 }

Definition in file pulse_decoder.h.