Junjie Wang
/
a_NYP_humanoid_copy
NYP_Humanoid_robot_FYP_2018
Fork of b_NYP_humanoid by
Diff: main.cpp
- Revision:
- 0:0ea84b3cf851
- Child:
- 2:7d574b1ab3cd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Apr 30 09:43:36 2018 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" +#include "rtos.h" + +#include "accgyro.h" +//Serial pc(USBTX, USBRX); +DigitalOut led2(LED2); +Thread eventthread; +EventQueue eventqueue; + +int main() +{ + ACCGYRO_init(); + eventthread.start(callback(&eventqueue, &EventQueue::dispatch_forever)); + //ACCGYRO_thread.start(ACCGYRO_init); + //Thread::wait(osWaitForever); + eventqueue.call_every(1000, ACCGYRO_task); + //q.dispatch(); + //eventqueue.call_every(1000,printf,"LSM6DSL [acc/mg]: %6ld\r\n", ACCGYRO_get_gyro_x()); + //q.dispatch(); + + + while(1) + { + eventqueue.call(printf,"LSM6DSL [acc/mg]: %6ld\r\n", ACCGYRO_get_gyro_x()); + led2 = !led2; + wait(1); + //q.dispatch(); + //q.call(printf, "*\n"); + //printf("*"); + //Thread::wait(1000); + //printf("LSM6DSL [acc/mg]: %6ld\r\n", ACCGYRO_get_gyro_x()); + //printf("LSM6DSL [gyro/mdps]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); + } +} \ No newline at end of file