Sound update
Dependencies: 4DGL-uLCD-SE Physac-MBED PinDetect SDFileSystem mbed-rtos mbed
Diff: main.cpp
- Revision:
- 24:3b29ae4d6171
- Parent:
- 23:214c0c828d98
- Child:
- 25:c3eb6c1a2dfb
diff -r 214c0c828d98 -r 3b29ae4d6171 main.cpp --- a/main.cpp Wed Dec 07 23:12:12 2022 +0000 +++ b/main.cpp Thu Dec 08 00:34:39 2022 +0000 @@ -113,13 +113,25 @@ Thread thread2(hockeyGame, osPriorityHigh); //Thread thread3(audioThread, osPriorityLow); Thread thread4(ledThread, osPriorityLow); - + int x = 0; // The main thread goes on to blink LEDs while (true) { led1 = 1; Thread::wait(500); led1 = 0; Thread::wait(500); + if(!game1 && !game2 && x==0){ + uLCD.color(WHITE); + uLCD.text_height(1); + uLCD.text_width(1); + uLCD.printf("UP:\n"); + uLCD.printf("Tetris \n"); + uLCD.printf("\n"); + uLCD.printf("DOWN:\n"); + uLCD.printf("Air\n"); + uLCD.printf("Hockey"); + x=1; + } PRINTF("[MAIN] Thread stacks: %lu %lu %lu %lu\r\n", thread1.used_stack(), @@ -128,6 +140,13 @@ thread4.used_stack()); // Launch into the air hockey game - if (game1 != true) game1 = true; + if (game1 != true && myNav.up()){ + uLCD.cls(); + game1 = true; + } + if (game2 != true && myNav.down()){ + uLCD.cls(); + game2 = true; + } } }