self-balancing-robot

Dependencies:   mbed mbed-rtos Motor

Committer:
emilmont
Date:
Fri Nov 23 09:58:48 2012 +0000
Revision:
3:c92e21f305d8
Parent:
1:491820ee784d
Child:
7:8d9919175929
Update to latest mbed and rtos libraries

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 1:491820ee784d 1 #include "mbed.h"
emilmont 1:491820ee784d 2 #include "rtos.h"
emilmont 1:491820ee784d 3
emilmont 1:491820ee784d 4 DigitalOut led1(LED1);
emilmont 1:491820ee784d 5 DigitalOut led2(LED2);
emilmont 1:491820ee784d 6
emilmont 3:c92e21f305d8 7 void led2_thread(void const *args) {
emilmont 1:491820ee784d 8 while (true) {
emilmont 1:491820ee784d 9 led2 = !led2;
emilmont 1:491820ee784d 10 Thread::wait(1000);
emilmont 1:491820ee784d 11 }
emilmont 1:491820ee784d 12 }
emilmont 1:491820ee784d 13
emilmont 1:491820ee784d 14 int main() {
emilmont 1:491820ee784d 15 Thread thread(led2_thread);
emilmont 1:491820ee784d 16
emilmont 1:491820ee784d 17 while (true) {
emilmont 1:491820ee784d 18 led1 = !led1;
emilmont 1:491820ee784d 19 Thread::wait(500);
emilmont 1:491820ee784d 20 }
emilmont 1:491820ee784d 21 }