Carbon Fibre / Mbed 2 deprecated Motor_test_harness

Dependencies:   Classic_PID iC_MU mbed-rtos mbed

Revision:
0:7ce0bc67f60f
Child:
1:1ad84260ff59
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ServiceKeyboard.cpp	Thu Apr 02 07:35:39 2015 +0000
@@ -0,0 +1,98 @@
+#include "mbed.h"
+#include "iC_MU.h"
+#include "rtos.h"
+#include "Classic_PID.h"
+
+extern Serial pc;
+extern Classic_PID PanVelocityPID;
+extern Classic_PID TiltVelocityPID;
+
+extern bool joystick;
+
+// Returns the new set point entered via the keyboard
+int ServiceKeyboard ()
+{
+    return(1);
+}
+    /*
+    int key;                                            // The keypress by the user
+    int value = 0;                                      // The variable to return
+
+    key = pc.getc();                                    // Read the intial keypress
+
+    if (key == 'j') {
+        joystick = !joystick;
+        if(joystick) {
+            pc.printf("\n\rJoystick");
+        } else {
+            pc.printf("\n\rPC");
+        }
+    } 
+    // Set Velocity for Pan and Tilt here...
+    else if(key == 'p') {
+        // We are going to set the speed of pan...
+        pc.printf("\n\r New Pan Vel: ");
+        key = pc.getc();
+        if (key == 0x1B) {
+            if(pc.getc() == 0x4F) {
+                if(pc.getc() == 0x53) {
+                    pc.printf("-");
+                    do {
+                        key = pc.getc();                            // Wait for a keypress
+                        if(key >= '0' && key <= '9') {              // Check it is a number
+                            value *= 10;                            // Index the old number
+                            value += (key - '0');                   // Add on the new number
+                            pc.printf("%c",key);                    // Display the new number
+                        }
+                    } while(key != 0x0D);
+                    PanVelocityPID.setSetPoint(value * -1);
+                }
+            }
+        } else if(key >= '0' && key <= '9') {                      // Check it is a number
+            pc.printf("%c",key);
+            value = (key - '0');
+            do {
+                key = pc.getc();                            // Wait for a keypress
+                if(key >= '0' && key <= '9') {              // Check it is a number
+                    value *= 10;                            // Index the old number
+                    value += (key - '0');                   // Add on the new number
+                    pc.printf("%c",key);                    // Display the new number
+                }
+            } while(key != 0x0D);
+            PanVelocityPID.setSetPoint(value);
+        }
+    } else if(key == 't') {
+        // We are going to set the speed of tilt...
+        pc.printf("\n\r New Tilt Vel: ");
+        key = pc.getc();
+        if (key == 0x1B) {
+            if(pc.getc() == 0x4F) {
+                if(pc.getc() == 0x53) {
+                    pc.printf("-");
+                    do {
+                        key = pc.getc();                            // Wait for a keypress
+                        if(key >= '0' && key <= '9') {              // Check it is a number
+                            value *= 10;                            // Index the old number
+                            value += (key - '0');                   // Add on the new number
+                            pc.printf("%c",key);                    // Display the new number
+                        }
+                    } while(key != 0x0D);
+                    TiltVelocityPID.setSetPoint(value * -1);
+                }
+            }
+        } else if(key >= '0' && key <= '9') {                      // Check it is a number
+            pc.printf("%c",key);
+            value = (key - '0');
+            do {
+                key = pc.getc();                            // Wait for a keypress
+                if(key >= '0' && key <= '9') {              // Check it is a number
+                    value *= 10;                            // Index the old number
+                    value += (key - '0');                   // Add on the new number
+                    pc.printf("%c",key);                    // Display the new number
+                }
+            } while(key != 0x0D);
+            TiltVelocityPID.setSetPoint(value);
+        }
+    }
+    return(1);
+}*/
\ No newline at end of file