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.cpp

Committer:
maetugr
Date:
2012-10-15
Revision:
7:9d4313510646
Child:
10:953afcbcebfc

File content as of revision 7:9d4313510646:

#include "RC_Channel.h"
#include "mbed.h"

RC_Channel::RC_Channel(PinName mypin) : myinterrupt(mypin)
{
    myinterrupt.rise(this, &RC_Channel::rise);
    myinterrupt.fall(this, &RC_Channel::fall);
}

int RC_Channel::read()
{
    return time;
}

void RC_Channel::rise()
{
    timer.start();
}

void RC_Channel::fall()
{
    timer.stop();
    time = timer.read_us();
    timer.reset();
}