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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "Set_up.h"
00003 #include "data_struct.h"
00004 #include "ahrs.h"
00005 #include "to_gcs.h"
00006 #include "i2C.h"
00007 #include "rcrx.h"
00008 
00009 int main() {
00010     setup();
00011     SendData.attach(&toGCS, 0.02777);
00012     Proccess.attach(&eyetosee, 0.1);
00013     ahrs.attach(&ahrs_rec);
00014     rc.rise(&PPM_rise);  // attach the address of the PPM_rise function to the rising edge
00015     rc.fall(&PPM_fall);  // attach the address of the PPM_fall function to the falling edge  
00016     wait(0.5);
00017     
00018     while(1) {
00019         eyetosee();
00020         myled = !myled;
00021         for(char i=0; i<6; i++){
00022             printf("%d\t", buf_ppm[i]);
00023             if(i == 5) printf("\n");           
00024             wait(0.02);
00025             }         
00026     }
00027 }