NOT FINISHED YET!!! My first try to get a self built fully working Quadrocopter based on an mbed, a self built frame and some other more or less cheap parts.

Dependencies:   mbed MODI2C

RC/RC_Channel.h

Committer:
maetugr
Date:
2012-10-17
Revision:
10:953afcbcebfc
Parent:
7:9d4313510646
Child:
12:67a06c9b69d5

File content as of revision 10:953afcbcebfc:

#ifndef RC_CHANNEL_H
#define RC_CHANNEL_H

#include "mbed.h"

class RC_Channel
{
    public:
        RC_Channel(PinName mypin); // NO p19/p20!!!!, they don't support InterruptIn
        int read(); // read the last measured data
       
    private:
        InterruptIn myinterrupt; // interrupt on the pin to react when signal falls or rises
        void rise(); // start the time measurement when signal rises
        void fall(); // stop the time mesurement and save the value when signal falls
        Timer timer; // timer to measure the up time of the signal and if the signal timed out
        int time; // last measurement data
        
        Ticker timeoutchecker; // Ticker to see if signal broke down
        void timeoutcheck(); // to check for timeout, checked every second
};

#endif