Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- lokitsyu
- Date:
- 2013-06-20
- Revision:
- 0:3137e34fc9fa
- Child:
- 1:5c6888eb051a
File content as of revision 0:3137e34fc9fa:
#include "mbed.h"
#include "rtos.h"
Interrupt unit(p8);
DigitalOut motors[4] = {
DigitalOut(p21),DigitalOut(p22),DigitalOut(p23), DigitalOut(p24)
};
void get_gyro(){}
//motor drive control funciton
void motordrv(void const *n, int outval){
motors[(int)n] = 1;
void wait_us(1000 + outval);
motors[(int)n] = 0;
}
//main function
int main() {
unit.fall(&get_gyro)
RtosTimer drv_1_timer(motordrv, osTimerPeriodic, (void *)0);
RtosTimer drv_2_timer(motordrv, osTimerPeriodic, (void *)1);
RtosTimer drv_3_timer(motordrv, osTimerPeriodic, (void *)2);
RtosTimer drv_4_timer(motordrv, osTimerPeriodic, (void *)3);
drv_1_timer.start(20);
drv_2_timer.start(20);
drv_3_timer.start(20);
drv_4_timer.start(20);
//main loop
while(1) {
/*
Write Program on This Space
*/
}
}