test RTOS
Revision 0:7f40098a12b6, committed 2014-04-30
- Comitter:
- kazu_zamasu
- Date:
- Wed Apr 30 18:08:44 2014 +0000
- Commit message:
- test
Changed in this revision
diff -r 000000000000 -r 7f40098a12b6 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Apr 30 18:08:44 2014 +0000 @@ -0,0 +1,56 @@ +#include "mbed.h" +#include "rtos.h" + +DigitalOut led1(P0_29); +DigitalOut led2(P0_9); +Serial pc(USBTX, USBRX); // tx, rx + +int a=0,b=0; +void led1_thread(void const *argument) { + while (true) { + led1 = !led1; + Thread::wait(500); + } +} + +void led2_thread(void const *argument) { + while (true) { + led2 = !led2; + a = a + 1; + Thread::wait(250); + } +} + +void print_thread(void const *argument) { + while (true) { + b = b + 1; + Thread::wait(500); + } +} + + +int main() { + Thread th1(led1_thread); + Thread th2(led2_thread); + Thread th3(print_thread); + pc.baud(115200); + while ( b < 300 ) { + pc.printf("\033[1;1H"); + pc.printf("LED_Count"); + pc.printf("\033[2;1H"); + pc.printf("%d",a); + pc.printf("\033[1;15H"); + pc.printf("b++ count"); + pc.printf("\033[2;15H"); + pc.printf("%d",b); + } + pc.printf("\033[1;1H"); + pc.printf("LED_Count"); + pc.printf("\033[2;1H"); + pc.printf("%d",a); + pc.printf("\033[1;15H"); + pc.printf("b++ count"); + pc.printf("\033[2;15H"); + pc.printf("%d",b); + +} \ No newline at end of file
diff -r 000000000000 -r 7f40098a12b6 mbed-rtos.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Wed Apr 30 18:08:44 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#5dfe422a963d
diff -r 000000000000 -r 7f40098a12b6 mbed.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.lib Wed Apr 30 18:08:44 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/#6473597d706e