Oskar Weigl
/
Eurobot2013
We are going to win! wohoo
Diff: main.cpp
- Revision:
- 3:8c78c15a92e3
- Parent:
- 0:92019d8564a7
- Child:
- 8:a8693e2daa00
diff -r 10e2b1b9c588 -r 8c78c15a92e3 main.cpp --- a/main.cpp Wed Nov 07 14:41:49 2012 +0000 +++ b/main.cpp Wed Nov 14 15:48:20 2012 +0000 @@ -1,12 +1,32 @@ #include "mbed.h" +#include "rtos.h" +#include "RFSRF05.h" +#include "math.h" +#include "globals.h" -DigitalOut myled(LED1); + +DigitalOut led1(LED1); +DigitalOut led2(LED2); -int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); +RFSRF05 My_Sonar(p13,p21,p22,p23,p24,p25,p26,p5,p6,p7,p8,p9); + +void Sonar_Callback(int num, float dist) { + //Here is where you deal with your brand new reading ;D + +} + +void led2_thread(void const *argument) { + while (true) { + led2 = !led2; + Thread::wait(1000); } } + +int main() { + My_Sonar.callbackfunc = Sonar_Callback; + Thread thread(led2_thread); + + while (true) { + Thread::wait(osWaitForever); + } +}