Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: biquadFilter FastPWM MODSERIAL QEI mbed
Diff: main.cpp
- Revision:
- 17:b04e1938491a
- Parent:
- 16:c2986e890040
- Child:
- 18:c74dfa681e09
diff -r c2986e890040 -r b04e1938491a main.cpp
--- a/main.cpp Thu Nov 01 10:16:10 2018 +0000
+++ b/main.cpp Thu Nov 01 10:18:04 2018 +0000
@@ -31,7 +31,7 @@
// Define & initialise state machine
enum states { calibratingMotors, calibratingEMG,
- homing, operating, reading, failing, demoing
+ homing, reading, operating, failing, demoing
};
states currentState = calibratingMotors;// start in waiting mode
bool changeState = true; // initialise the first state
@@ -492,6 +492,35 @@
}
break; // end case
+// ============================== READING MODE =============================== // Beweegt deze modus zowel heen als weer en zo ja, hoe bepaalt hij wat moet gebeuren?
+ case reading:
+// ------------------------- initialisation --------------------------
+ if (changeState) { // when entering the state
+ pc.printf("[MODE] reading...\r\n");
+ // print current state
+ changeState = false; // stay in this state
+
+ // Actions when entering state
+ ledRed = 1; // blue LED on
+ ledGreen = 1;
+ ledBlue = 0;
+
+ }
+// ----------------------------- action ------------------------------
+ // Actions for each loop iteration
+ /* */
+
+// --------------------------- transition ----------------------------
+ // Transition condition #1: with button press, back to homing mode // Hier automatisch terug naar operating mode!
+ if (1) { // En hij gaat nu terug naar homing mode, maar dan moet je dus elke keer weer kiezen voor demo of operation mode?
+ // Actions when leaving state // CONDITION
+ /* */
+
+ currentState = homing; // change to state
+ changeState = true; // next loop, switch states
+ }
+ break; // end case
+
// ============================= OPERATING MODE ==============================
case operating:
// ------------------------- initialisation --------------------------
@@ -531,35 +560,6 @@
}
break; // end case
-// ============================== READING MODE =============================== // Beweegt deze modus zowel heen als weer en zo ja, hoe bepaalt hij wat moet gebeuren?
- case reading:
-// ------------------------- initialisation --------------------------
- if (changeState) { // when entering the state
- pc.printf("[MODE] reading...\r\n");
- // print current state
- changeState = false; // stay in this state
-
- // Actions when entering state
- ledRed = 1; // blue LED on
- ledGreen = 1;
- ledBlue = 0;
-
- }
-// ----------------------------- action ------------------------------
- // Actions for each loop iteration
- /* */
-
-// --------------------------- transition ----------------------------
- // Transition condition #1: with button press, back to homing mode // Hier automatisch terug naar operating mode!
- if (1) { // En hij gaat nu terug naar homing mode, maar dan moet je dus elke keer weer kiezen voor demo of operation mode?
- // Actions when leaving state // CONDITION
- /* */
-
- currentState = homing; // change to state
- changeState = true; // next loop, switch states
- }
- break; // end case
-
// ============================== DEMOING MODE ===============================
case demoing:
// ------------------------- initialisation --------------------------
