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 rcrx.h Source File

rcrx.h

00001 Timer tick;
00002 InterruptIn rc(p11);
00003 short buf_ppm[5];
00004 char i = 0;
00005 
00006 void PPM_rise() {
00007     tick.stop();                        // Stop timer
00008     buf_ppm[i]=tick.read_us();          // Read timer to buffer[i] i=turns
00009     tick.reset();                       // Reset timer
00010     i++;                                // increment i.
00011     if (i==6) i = 0;
00012     return;
00013 }
00014 
00015 void PPM_fall() {                      // Rising edge on the serial comm
00016     tick.start();                      // Start the timer
00017     return;
00018 }