Add Serial UART communication to display action messages (Play notes X, release notes, change gamme X to gamme Y)
Fork of Nucleo_piano_final_clean by
Diff: main.cpp
- Revision:
- 9:653ee515b0ad
- Parent:
- 8:781b03221397
--- a/main.cpp Wed Jul 04 21:47:32 2018 +0000 +++ b/main.cpp Wed Jul 04 22:17:46 2018 +0000 @@ -12,8 +12,11 @@ // Define the PWM speaker PwmOut speaker(PB_10); -//Define Bus In for Gamme Button +// Define Bus In for Gamme Button BusIn Bus_In_Gamme(PB_9); + +// Define Serial +Serial pc(PA_2, PA_3); //Define variables for sound struct NoteReference { @@ -123,9 +126,14 @@ lcd.cls(); lockGamme.lock(); if (strcmp(bufferOutput, "")) + { lcd.printf("%s- g[%d]", bufferOutput, gamme); - else + pc.printf("Play notes: %s with gamme %d\n", bufferOutput, gamme); + } + else { lcd.printf("Gamme = %d", gamme); + pc.printf("Release notes\n"); + } lockGamme.unlock(); strcpy(old_buffer, bufferOutput); } @@ -135,6 +143,7 @@ { lcd.cls(); lcd.printf("Gamme = %d", gamme); + pc.printf("Change gamme %d to gamme %d\n", old_gamme, gamme); old_gamme = gamme; } lockGamme.unlock();