Non-variable (TESTEDandWORKING)

Dependencies:   mbed-rtos mbed

Fork of ELEC347_Coursework by CMST

Revision:
9:91c53a683856
Parent:
8:192b376a6da7
Child:
10:3495fff88da7
--- a/main.cpp	Tue Nov 28 15:19:08 2017 +0000
+++ b/main.cpp	Tue Nov 28 15:42:35 2017 +0000
@@ -22,6 +22,7 @@
 
 //Declare Threads
 Thread t1;
+Thread t2;
 
 //Declare Ticker Rates
 float sample_rate = (1.0/35000);        //Rate of sampling
@@ -50,7 +51,7 @@
 
 int main()
 {
-    sample_timer.attach(&sampler,sample_rate);
+    t2.start(sampler);
     t1.start(coeff_update);
     printf("Hello");
 }
@@ -75,18 +76,23 @@
             BP_filter.Update_Q(Q_Current);                  //Update Q
         }
         BP_filter.Define_Filter();                          //Calculate the coefficients
-        BP_filter.Print_Filter();                           //Print the ceofficients
+        //BP_filter.Print_Filter();                           //Print the ceofficients
+        printf("Q = %d \t Boost = %f \t Fo = %d\n\r", BP_filter.Get_Q(), BP_filter.Get_Boost(), BP_filter.Get_Fo());
+        Thread::wait(500);
     }
 }
 
 void sampler(void)
 {
-    SampLED = 1;                        //LED Indicates start of sampling
-
-    input = Ain;
-    BP_filter.setvalue(input);          //Input ADC. N.B. ADC in MBED is 0.0 to 1.0 float!!!!!!
-    Aout = BP_filter.getvalue();
+    while(1)
+    {
+        SampLED = 1;                        //LED Indicates start of sampling
     
-
-    SampLED = 0;      //LED Indicates end of sampling
+        input = Ain;
+        BP_filter.setvalue(input);          //Input ADC. N.B. ADC in MBED is 0.0 to 1.0 float!!!!!!
+        Aout = BP_filter.getvalue();
+        
+    
+        SampLED = 0;      //LED Indicates end of sampling
+    }
 }
\ No newline at end of file