Read IMU data at Serial port (p28, p27), data rate <100Hz @115200bps Read 5 channels PPM signal at p11 using InterruptIn Send data via RF Modem at serial port (p13, p14) in 36Hz @115200 Drive i2C motor speed controller at I2C port (p9, p10) in every 10mS (control loop delay time)

Dependencies:   mbed

main.cpp

Committer:
agiembed
Date:
2010-08-12
Revision:
0:bd282c11d296

File content as of revision 0:bd282c11d296:

#include "mbed.h"
#include "struct.h"

short test, test1;

#include "i2c.h"
#include "rc.h"
#include "setup.h"
#include "2gcs.h"
#include "ahrs.h"

    
int main() {
    setup();
    //SendData.attach(&toGCS, 0.02777);
    //Proccess.attach(&eyetosee, 0.1);     
    ahrs.attach(&ahrs_rec);       
    rc.rise(&PPM_rise);    // attach the address of the PPM_rise function to the rising edge
    
    while(1) {           // wait around, interrupts will interrupt this!
        printf("%d\t", RC.roll);
        printf("%d\t", RC.throttle);
        printf("%d\t", RC.pitch);
        printf("%d\t", RC.yaw);
        printf("%d\n", RC.sw);
        wait(0.02);
        //for(char i=0; i<6; i++){
        //  printf("%d\t", buf_ppm[i]);
        //  bl_L[1]= abs(test - test1);
        //  if(buf_ppm[i] > 5000) printf("%d\t%d\t%d\n", test, test1, bl_L[1]); //("%d\t%d\n", buf_ppm[i], i);          
        //    wait(0.02);
        //    }      
    }
}