piano 4 octaves, 8 notes, 3 threads, 2 outputs, no bug, clean code, comments, remove old .h

Dependencies:   TextLCD

Fork of Nucleo_piano_CS435 by karine aknin

Committer:
bcostm
Date:
Thu Mar 17 15:17:54 2016 +0000
Revision:
0:5701b41769fd
Child:
2:35f13b7f3659
First release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:5701b41769fd 1 #include "mbed.h"
bcostm 0:5701b41769fd 2 #include "rtos.h"
bcostm 0:5701b41769fd 3
bcostm 0:5701b41769fd 4 void print_char(char c = '*')
bcostm 0:5701b41769fd 5 {
bcostm 0:5701b41769fd 6 printf("%c", c);
bcostm 0:5701b41769fd 7 fflush(stdout);
bcostm 0:5701b41769fd 8 }
bcostm 0:5701b41769fd 9
bcostm 0:5701b41769fd 10 DigitalOut led1(LED1);
bcostm 0:5701b41769fd 11
bcostm 0:5701b41769fd 12 void print_thread(void const *argument)
bcostm 0:5701b41769fd 13 {
bcostm 0:5701b41769fd 14 while (true) {
bcostm 0:5701b41769fd 15 Thread::wait(1000);
bcostm 0:5701b41769fd 16 print_char();
bcostm 0:5701b41769fd 17 }
bcostm 0:5701b41769fd 18 }
bcostm 0:5701b41769fd 19
bcostm 0:5701b41769fd 20 int main()
bcostm 0:5701b41769fd 21 {
bcostm 0:5701b41769fd 22 printf("\n\n*** RTOS basic example ***\n");
bcostm 0:5701b41769fd 23 Thread thread(print_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE);
bcostm 0:5701b41769fd 24 while (true) {
bcostm 0:5701b41769fd 25 led1 = !led1;
bcostm 0:5701b41769fd 26 Thread::wait(500);
bcostm 0:5701b41769fd 27 }
bcostm 0:5701b41769fd 28 }