simon says
Dependencies: 4DGL-uLCD-SE Joystick SDFileSystem mbed wave_player
Diff: main.cpp
- Revision:
- 0:aa7531dac907
- Child:
- 1:6a079fb5542e
diff -r 000000000000 -r aa7531dac907 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 09 21:53:59 2017 +0000 @@ -0,0 +1,68 @@ +#include "mbed.h" +#include "SDFileSystem.h" +#include "uLCD_4DGL.h" +#include "wave_player.h" +#include "Joystick.h" + + +Nav_Switch myNav( p9, p6, p7, p5, p8); +uLCD_4DGL uLCD(p28, p27, p29); +SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card + +int arrowVec[20]; + + +int arrow; + +void mainMenu() { + uLCD.baudrate(BAUD_3000000); + while(1){ + uLCD.locate(3,2); + uLCD.puts("Simon Says"); + uLCD.locate(3,6); + uLCD.puts("Start"); + if(myNav.fire()) { + uLCD.cls(); + return; + } +} +} +void createArrows(int lev) { + + for (int i = 0; i < lev; i++) { + if (arrowVec[i] == 1) { + uLCD.triangle(15, 50, 35, 45, 35, 75, RED); + uLCD.rectangle(35,50,85,70,RED); + } else if (arrowVec[i] == 2) { + //uLCD.triangle(int x1, int y1 , int x2, int y2, int x3, int y3, RED); + uLCD.rectangle(35,50,85,70,BLUE); + } else if (arrowVec[i] == 3) { + //uLCD.triangle(); + uLCD.rectangle(35,50,85,70,GREEN); + } else { + uLCD.rectangle(35,50,85,70,WHITE); + } + } +} + + +int main() { + bool game = true; + int level = 0; + //int arrowVec[20]; + //void mainMenu(); + + + while(game) { + level++; +// for (int i = 0; i < level; i++) { +// arrow = (rand() % 4) + 1; +// arrowVec[i] = arrow; +// } + arrowVec[0] = 1; + createArrows(level); + game = false; + } + + +}