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)
main.cpp@0:bd282c11d296, 2010-08-12 (annotated)
- Committer:
- agiembed
- Date:
- Thu Aug 12 01:08:40 2010 +0000
- Revision:
- 0:bd282c11d296
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
agiembed | 0:bd282c11d296 | 1 | #include "mbed.h" |
agiembed | 0:bd282c11d296 | 2 | #include "struct.h" |
agiembed | 0:bd282c11d296 | 3 | |
agiembed | 0:bd282c11d296 | 4 | short test, test1; |
agiembed | 0:bd282c11d296 | 5 | |
agiembed | 0:bd282c11d296 | 6 | #include "i2c.h" |
agiembed | 0:bd282c11d296 | 7 | #include "rc.h" |
agiembed | 0:bd282c11d296 | 8 | #include "setup.h" |
agiembed | 0:bd282c11d296 | 9 | #include "2gcs.h" |
agiembed | 0:bd282c11d296 | 10 | #include "ahrs.h" |
agiembed | 0:bd282c11d296 | 11 | |
agiembed | 0:bd282c11d296 | 12 | |
agiembed | 0:bd282c11d296 | 13 | int main() { |
agiembed | 0:bd282c11d296 | 14 | setup(); |
agiembed | 0:bd282c11d296 | 15 | //SendData.attach(&toGCS, 0.02777); |
agiembed | 0:bd282c11d296 | 16 | //Proccess.attach(&eyetosee, 0.1); |
agiembed | 0:bd282c11d296 | 17 | ahrs.attach(&ahrs_rec); |
agiembed | 0:bd282c11d296 | 18 | rc.rise(&PPM_rise); // attach the address of the PPM_rise function to the rising edge |
agiembed | 0:bd282c11d296 | 19 | |
agiembed | 0:bd282c11d296 | 20 | while(1) { // wait around, interrupts will interrupt this! |
agiembed | 0:bd282c11d296 | 21 | printf("%d\t", RC.roll); |
agiembed | 0:bd282c11d296 | 22 | printf("%d\t", RC.throttle); |
agiembed | 0:bd282c11d296 | 23 | printf("%d\t", RC.pitch); |
agiembed | 0:bd282c11d296 | 24 | printf("%d\t", RC.yaw); |
agiembed | 0:bd282c11d296 | 25 | printf("%d\n", RC.sw); |
agiembed | 0:bd282c11d296 | 26 | wait(0.02); |
agiembed | 0:bd282c11d296 | 27 | //for(char i=0; i<6; i++){ |
agiembed | 0:bd282c11d296 | 28 | // printf("%d\t", buf_ppm[i]); |
agiembed | 0:bd282c11d296 | 29 | // bl_L[1]= abs(test - test1); |
agiembed | 0:bd282c11d296 | 30 | // 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); |
agiembed | 0:bd282c11d296 | 31 | // wait(0.02); |
agiembed | 0:bd282c11d296 | 32 | // } |
agiembed | 0:bd282c11d296 | 33 | } |
agiembed | 0:bd282c11d296 | 34 | } |