Group 9 BioRobotics / Mbed 2 deprecated the_code

Dependencies:   HIDScope Servo mbed QEI biquadFilter

Revision:
4:8183e7b228f0
Parent:
3:624051175fdd
Child:
5:3581013d4505
diff -r 624051175fdd -r 8183e7b228f0 main.cpp
--- a/main.cpp	Fri Oct 19 12:41:03 2018 +0000
+++ b/main.cpp	Mon Oct 22 07:08:45 2018 +0000
@@ -5,8 +5,8 @@
 #include "QEI" // For encoder of motors 
 
 // In- en outputs //
-//-------------------------------------------------------------
-//Kenneth
+// -----------------------------------------------------------------------------
+
 // EMG related
 AnalogIn emg1(A0); // EMG signal 1
 AnalogIn emg2(A1); // EMG signal 2
@@ -23,9 +23,16 @@
 
 // Extra stuff
 // Like LED lights, buttons etc 
+DigitalIn button_motorcal(SW1); // button for motor calibration
+DigitalIn button_emergency(SW2); // button for emergency mode
+DigitalIn button_start(SW3); // button for start mode (from demo mode)
+DigitalIn button_demo(SW4); // button for demo mode 
+DigitalIn led_red(LED_RED); // red led 
+DigitalIn led_green(LED_GREEN); // green led
+DigitalIn led_blue(LED_BLUE); // blue led
 
 // Other stuff
-// ------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // Define stuff like tickers etc
 
 Ticker NAME; // Name a ticker, use each ticker only for 1 function! 
@@ -34,20 +41,29 @@
 MODSERIAL pc(USBTX,USBRX);
 
 // Variables 
-// ------------------------------------------------------------ 
+// ----------------------------------------------------------------------------- 
 // Define here all variables needed throughout the whole code 
 
 // Functions
-// ------------------------------------------------------------
+// -----------------------------------------------------------------------------
  
+// Encoder 
+// Getting encoder information from motors
+int encoder()
+{
+    counts = Encoder.getPulses();
+    return counts;
+    }
+
 // Motor calibration
 // To calibrate the motor angle to some mechanical boundaries
+// Kenneth mee bezig 
 
 // EMG calibration
 // To calibrate the EMG signal to some boundary values
 
 // Send EMG to HIDScope
-void sample() // attach this to a ticker! 
+void sample() // Attach this to a ticker! 
 {
     scope.set(0, emg1.read()); // send EMG 1 to channel 1 (=0)
     scope.set(1, emg2.read()); // sent EMG 2 to channel 2 (=1)
@@ -61,26 +77,39 @@
 
 // Start
 // To move the robot to the starting position: middle
+void start() 
+{
+    // move to middle
+    }
 
 // Operating mode
 // To control the robot with EMG signals
 
 // Processing EMG 
 // To process the raw EMG to a usable value, with filters etc
+// Simon en Kees mee bezig 
 
 // Demo mode
 // To control the robot with a written code and write 'HELLO'
+// Voor het laatst bewaren
 
 // Emergency mode
 // To shut down the robot after an error etc 
 
 // Main function
-// ------------------------------------------------------------
+// -----------------------------------------------------------------------------
 int main()
 {
     pc.baud(115200); // For TeraTerm, the baudrate, set also in TeraTerm itself! 
     pc.printf("Start code\r\n"); // To check if the program starts 
     
     while(true){
-        //Laura verandert iets
+        if (button_motorcal == true){
+            // execute motor calibration
+            }
+        elseif {
+            // remain in waiting mode 
+            break;
+            }
+            
 }
\ No newline at end of file