This is my quadcopter prototype software, still in development!

quadv3/pwmout.h

Committer:
Anaesthetix
Date:
2013-07-23
Revision:
1:ac68f0368a77
Parent:
0:978110f7f027

File content as of revision 1:ac68f0368a77:

#ifndef PWMOUT_H
#define PWMOUT_H

#include "mbed.h"

PwmOut motor1(p24);
PwmOut motor2(p23);
PwmOut motor3(p22);
PwmOut motor4(p21);

void startpwm(void);
void setpwm(signed int, signed int, signed int, signed int);


void startpwm() {
    motor1.period_ms(5);
//    motor2.period_ms(15);
//    motor3.period_ms(15);
//    motor4.period_ms(15);
    
    motor1.pulsewidth_us(1200);
    motor2.pulsewidth_us(1200);
    motor3.pulsewidth_us(1200);
    motor4.pulsewidth_us(1200);
    }
    
void setpwm(signed int pwm1, signed int pwm2, signed int pwm3, signed int pwm4) {
    motor1.pulsewidth_us(pwm1);
    motor2.pulsewidth_us(pwm2);
    motor3.pulsewidth_us(pwm3);
    motor4.pulsewidth_us(pwm4);
    }
    
#endif