ECE3872 HW/SW Project Code
Dependencies: mbed Servo mbed-rtos 4DGL-uLCD-SE PinDetect X_NUCLEO_53L0A1
Revision 14:7e81f2cd4b4b, committed 2020-04-11
- Comitter:
- nnguyen99
- Date:
- Sat Apr 11 20:00:59 2020 +0000
- Parent:
- 13:3ae48dd67009
- Child:
- 15:7565013b55df
- Child:
- 16:62976c3c029e
- Commit message:
- State machine completely functional
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Apr 11 19:47:56 2020 +0000
+++ b/main.cpp Sat Apr 11 20:00:59 2020 +0000
@@ -86,15 +86,17 @@
if(key_input == '4') P=1; //toggle play
if(key_input == '5') E=1; //toggle erase
}
- pc.printf("X: %d\n",X);
- pc.printf("S: %d\n",S);
- pc.printf("R: %d\n",R);
- pc.printf("P: %d\n",P);
- pc.printf("E: %d\n",E);
- pc.printf("Current State %d\n",curr_state);
+ //pc.printf("X: %d\n",X);
+// pc.printf("S: %d\n",S);
+// pc.printf("R: %d\n",R);
+// pc.printf("P: %d\n",P);
+// pc.printf("E: %d\n",E);
+// pc.printf("Current State %d\n",curr_state);
switch(curr_state){
case 1:
-// pc.printf("RESET\n");
+ pc.printf("RESET\n");
+ P = 0;
+ R = 0;
if(E){
curr_state = 5;
X = 0;
@@ -105,7 +107,8 @@
reset();
break;
case 2:
-// pc.printf("STOP\n");
+ pc.printf("STOP\n");
+ E = 0;
if(X){
curr_state = 1;
S = 0;
@@ -119,7 +122,9 @@
stop();
break;
case 3:
-// pc.printf("RECORD\n");
+ pc.printf("RECORD\n");
+ E = 0;
+ P = 0;
if(X){
curr_state = 1;
R = 0;
@@ -130,7 +135,9 @@
record();
break;
case 4:
-// pc.printf("PLAY\n");
+ pc.printf("PLAY\n");
+ E = 0;
+ R = 0;
if(X){
curr_state = 1;
P = 0;
@@ -141,7 +148,10 @@
play();
break;
case 5:
-// pc.printf("ERASE\n");
+ pc.printf("ERASE\n");
+ S = 0;
+ P = 0;
+ R = 0;
if(X){
curr_state = 1;
E = 0;
