V001. 2017_11_30 10:21 Working code from Tuesday's lab session.

Dependencies:   mbed-rtos mbed

Fork of 2017_11_28_ELEC347_Coursework by Chris Hills

DSP Coursework ELEC347 2017-2018 Group members: Matthew Thewsey, Thomas Morris, Samuel Waggett, Christopher Hills .

Revision:
17:5774c69932e7
Parent:
15:97b4fa094a48
Child:
18:b442994a01fd
diff -r 97b4fa094a48 -r 5774c69932e7 main.cpp
--- a/main.cpp	Tue Dec 05 16:08:01 2017 +0000
+++ b/main.cpp	Wed Dec 06 02:44:22 2017 +0000
@@ -6,7 +6,7 @@
 
 //Init  values for difference equation
 //MBED Class Instances follows
-DigitalOut SampLED(LED1);              //Digital Output  (GREEN LED is PB_3, D13 You can use an Oscilloscope on This pin to confirm sample rate)
+DigitalOut SampLED(LED1);               //Digital Output  (GREEN LED is PB_3, D13 You can use an Oscilloscope on This pin to confirm sample rate)
 
 //Analog Inputs
 AnalogIn  Ain(PA_1);                    //Analog Input (Signal Input 0 to +3 Volts)
@@ -24,7 +24,7 @@
 
 
 //Declare Filter
-FILTER BP_filter(48000,70,16,1);  //Create object of type Filter(Fs,Fo,Boost,Q)
+FILTER BP_filter(48000,10000,16,2);        //Create object of type Filter(Fs,Fo,Boost,Q)
 
 
 //Forward Declarations
@@ -33,19 +33,19 @@
 
 int main()
 {
-    BP_filter.Define_Filter();
-    t1.start(sampler);//Start the Sampler timed interrupt
+    BP_filter.Define_Filter();          //Define the filter variables
+    t1.start(sampler);                  //Start the Sampler timed interrupt
 }
 
 void sampler(void)
 {
     while(1)
     {
-        SampLED = 1;//LED Indicates start of sampling
-        input = Ain;//Takes ADC input  as a Varaible type float
-        BP_filter.setvalue(input);//Input ADC. N.B. ADC in MBED is 0.0 to 1.0 float!!!!!!
-        Aout = BP_filter.getvalue();//Sets the input value to the Class
-        SampLED = 0;//LED Indicates end of sampling
-        Thread::wait(sample_rate*1000);//Look at this
+        SampLED = 1;                                //LED Indicates start of sampling
+        input = Ain;                                //Takes ADC input  as a Varaible type float
+        BP_filter.setvalue(input);                  //Passes the input value to the filter
+        Aout = BP_filter.getvalue();                //Collects the output from the filter and outputs it
+        SampLED = 0;                                //LED Indicates end of sampling
+        Thread::wait(sample_rate*1000);             //Delay before taking the next sample
     }
 }