De hele robot in 1 keer bam

Dependencies:   mbed QEI Servo HIDScope biquadFilter MODSERIAL FastPWM

Revision:
52:fd35025574ca
Parent:
51:7fe2659a1fcb
Child:
53:35282a3e0cad
--- a/main.cpp	Thu Oct 31 20:43:28 2019 +0000
+++ b/main.cpp	Thu Oct 31 20:47:57 2019 +0000
@@ -1115,6 +1115,7 @@
     // Entry function
     if ( global_state_changed == true ) {
         global_state_changed = false;
+        set_led_color('r'); // Set failure mode LED (RED)
 
         failure_mode = true; // Set failure mode
     }
@@ -1126,6 +1127,7 @@
     if ( false ) { // Never move to other state
         global_curr_state = global_wait;
         global_state_changed = true;
+        set_led_color('o'); // Disable failure mode LED
     }
 }
 
@@ -1135,6 +1137,7 @@
     // Entry function
     if ( global_state_changed == true ) {
         global_state_changed = false;
+        set_led_color('y'); // Set demo mode LED (YELLOW)
 
         if ( motor_cal_done == true ) {
             demo_curr_state = demo_wait;
@@ -1157,6 +1160,7 @@
         switch2_pressed = false;
         global_curr_state = global_wait;
         global_state_changed = true;
+        set_led_color('o'); // Disable demo mode LED
     }
 }
 
@@ -1166,6 +1170,7 @@
     // Entry function
     if ( global_state_changed == true ) {
         global_state_changed = false;
+        set_led_color('w'); // Set wait mode LED (WHITE)
     }
 
     // Do nothing until end condition is met
@@ -1175,20 +1180,24 @@
         switch2_pressed = false;
         global_curr_state = global_demo;
         global_state_changed = true;
+        set_led_color('o'); // Disable wait mode LED
 
     } else if ( button1_pressed == true ) { // EMG CALIBRATION
         button1_pressed = false;
         global_curr_state = global_emg_cal;
         global_state_changed = true;
+        set_led_color('o'); // Disable wait mode LED
 
     } else if ( button2_pressed == true ) { // MOTOR CALIBRATION
         button2_pressed = false;
         global_curr_state = global_motor_cal;
         global_state_changed = true;
+        set_led_color('o'); // Disable wait mode LED
 
     } else if ( emg_cal_done && motor_cal_done ) { // OPERATION MODE
         global_curr_state = global_operation;
         global_state_changed = true;
+        set_led_color('o'); // Disable wait mode LED
     }
 }
 
@@ -1259,6 +1268,7 @@
         exit_operation = false;
         global_curr_state = global_wait;
         global_state_changed = true;
+        set_led_color('o'); // Disable operation led
     }
 }
 /*