![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
piano 4 octaves, 8 notes, 3 threads, 2 outputs, no bug, clean code, comments, remove old .h
Fork of Nucleo_piano_CS435 by
Diff: main.cpp
- Revision:
- 0:5701b41769fd
- Child:
- 2:35f13b7f3659
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 17 15:17:54 2016 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "rtos.h" + +void print_char(char c = '*') +{ + printf("%c", c); + fflush(stdout); +} + +DigitalOut led1(LED1); + +void print_thread(void const *argument) +{ + while (true) { + Thread::wait(1000); + print_char(); + } +} + +int main() +{ + printf("\n\n*** RTOS basic example ***\n"); + Thread thread(print_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); + while (true) { + led1 = !led1; + Thread::wait(500); + } +}