Junjie Wang
/
humanoid
NYP
Fork of a_NYP_humanoid by
main.cpp@0:0ea84b3cf851, 2018-04-30 (annotated)
- Committer:
- mr_wang
- Date:
- Mon Apr 30 09:43:36 2018 +0000
- Revision:
- 0:0ea84b3cf851
- Child:
- 2:7d574b1ab3cd
NYP_humanoid
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mr_wang | 0:0ea84b3cf851 | 1 | #include "mbed.h" |
mr_wang | 0:0ea84b3cf851 | 2 | #include "rtos.h" |
mr_wang | 0:0ea84b3cf851 | 3 | |
mr_wang | 0:0ea84b3cf851 | 4 | #include "accgyro.h" |
mr_wang | 0:0ea84b3cf851 | 5 | //Serial pc(USBTX, USBRX); |
mr_wang | 0:0ea84b3cf851 | 6 | DigitalOut led2(LED2); |
mr_wang | 0:0ea84b3cf851 | 7 | Thread eventthread; |
mr_wang | 0:0ea84b3cf851 | 8 | EventQueue eventqueue; |
mr_wang | 0:0ea84b3cf851 | 9 | |
mr_wang | 0:0ea84b3cf851 | 10 | int main() |
mr_wang | 0:0ea84b3cf851 | 11 | { |
mr_wang | 0:0ea84b3cf851 | 12 | ACCGYRO_init(); |
mr_wang | 0:0ea84b3cf851 | 13 | eventthread.start(callback(&eventqueue, &EventQueue::dispatch_forever)); |
mr_wang | 0:0ea84b3cf851 | 14 | //ACCGYRO_thread.start(ACCGYRO_init); |
mr_wang | 0:0ea84b3cf851 | 15 | //Thread::wait(osWaitForever); |
mr_wang | 0:0ea84b3cf851 | 16 | eventqueue.call_every(1000, ACCGYRO_task); |
mr_wang | 0:0ea84b3cf851 | 17 | //q.dispatch(); |
mr_wang | 0:0ea84b3cf851 | 18 | //eventqueue.call_every(1000,printf,"LSM6DSL [acc/mg]: %6ld\r\n", ACCGYRO_get_gyro_x()); |
mr_wang | 0:0ea84b3cf851 | 19 | //q.dispatch(); |
mr_wang | 0:0ea84b3cf851 | 20 | |
mr_wang | 0:0ea84b3cf851 | 21 | |
mr_wang | 0:0ea84b3cf851 | 22 | while(1) |
mr_wang | 0:0ea84b3cf851 | 23 | { |
mr_wang | 0:0ea84b3cf851 | 24 | eventqueue.call(printf,"LSM6DSL [acc/mg]: %6ld\r\n", ACCGYRO_get_gyro_x()); |
mr_wang | 0:0ea84b3cf851 | 25 | led2 = !led2; |
mr_wang | 0:0ea84b3cf851 | 26 | wait(1); |
mr_wang | 0:0ea84b3cf851 | 27 | //q.dispatch(); |
mr_wang | 0:0ea84b3cf851 | 28 | //q.call(printf, "*\n"); |
mr_wang | 0:0ea84b3cf851 | 29 | //printf("*"); |
mr_wang | 0:0ea84b3cf851 | 30 | //Thread::wait(1000); |
mr_wang | 0:0ea84b3cf851 | 31 | //printf("LSM6DSL [acc/mg]: %6ld\r\n", ACCGYRO_get_gyro_x()); |
mr_wang | 0:0ea84b3cf851 | 32 | //printf("LSM6DSL [gyro/mdps]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); |
mr_wang | 0:0ea84b3cf851 | 33 | } |
mr_wang | 0:0ea84b3cf851 | 34 | } |