This is for ICRS\' second generation Quadcopter

Dependencies:   mbed

motors.h

Committer:
madcowswe
Date:
2011-11-18
Revision:
0:0bbf2f16da9c

File content as of revision 0:0bbf2f16da9c:


void initmotor() {
    PWMleft.period_ms(20);
    PWMleft = NOPOWER;
    PWMright.period_ms(20);
    PWMright = NOPOWER;

    PWMfront.period_ms(20);
    PWMfront = NOPOWER;
    PWMrear.period_ms(20);
    PWMrear = NOPOWER;
}

void leftM(float thrust) {
    float output = (542 + 0.462 * thrust) / 10000;
    if (output > 0.0950) {
        PWMleft = 0.0950;
        motormaxled = 1;
    } else {
        PWMleft = output;
    }
}

void rightM(float thrust) {
    float output = (542 + 0.462 * thrust) / 10000;
    if (output > 0.0950) {
        PWMright = 0.0950;
        motormaxled = 1;
    } else {
        PWMright = output;
    }
}

void frontM(float thrust) {
    float output = (542 + 0.462 * thrust) / 10000;
    if (output > 0.950) {
        PWMfront = 0.0950;
        motormaxled = 1;
    } else {
        PWMfront = output;
    }
}

void rearM(float thrust) {
    float output = (542 + 0.462 * thrust) / 10000;
    if (output > 0.0950) {
        PWMrear = 0.0950;
        motormaxled = 1;
    } else {
        PWMrear = output;
    }
}