Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:230a31b32cc1, committed 2016-04-29
- Comitter:
- noutram
- Date:
- Fri Apr 29 07:49:43 2016 +0000
- Commit message:
- Simple example of using getchar()
Changed in this revision
diff -r 000000000000 -r 230a31b32cc1 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Apr 29 07:49:43 2016 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" +#include "rtos.h" + +unsigned int delayms = 1000; + +void print_char(char c = '*') +{ + printf("%c", c); + fflush(stdout); +} + +DigitalOut led1(LED1); + +void print_thread(void const *argument) +{ + while (true) { + Thread::wait(delayms); + led1 = !led1; + } +} + +void read_keyboard(void const *argument) +{ + char c; + while (true) { + + c = getchar(); + printf("\t%X\n", c); + } +} + + +int main() +{ + printf("\n\n*** RTOS basic example ***\n"); + Thread t1(print_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); + Thread t2(read_keyboard); + + //Sleep the main thread + Thread::wait(osWaitForever); +}
diff -r 000000000000 -r 230a31b32cc1 mbed-rtos.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Fri Apr 29 07:49:43 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#3b7dd22a5b25
diff -r 000000000000 -r 230a31b32cc1 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Apr 29 07:49:43 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/aae6fcc7d9bb \ No newline at end of file