Morgan Mayborne / Mbed OS Lab3_experiment_example

Dependencies:   ExperimentServer QEI_pmw MotorShield

Revision:
18:54195aa5e534
Parent:
17:98e298577f09
Child:
19:d58bf34141e9
--- a/main.cpp	Fri Sep 25 01:07:22 2020 +0000
+++ b/main.cpp	Fri Sep 25 18:30:00 2020 +0000
@@ -6,7 +6,7 @@
 #include "MotorShield.h" 
 #include "HardwareSetup.h"
 
-#define NUM_INPUTS 8
+#define NUM_INPUTS 9
 #define NUM_OUTPUTS 6
 float velocity = 0;
 float current = 0;
@@ -19,6 +19,7 @@
 float R =0;
 float emf =0;
 float th_d= 0;
+float period=0;
 
 Serial pc(USBTX, USBRX);    // USB Serial Terminal
 ExperimentServer server;    // Object that lets us communicate with MATLAB
@@ -88,8 +89,9 @@
             float k = input_params[5];
             float b = input_params[6];
             float D = input_params[7];
+            period = input_params[8];
             
-            ControlLoop.attach(&current_control,0.0001); //start current loop
+            ControlLoop.attach(&current_control,period); //start current loop
             
             // Setup experiment
             t.reset();