Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Encoder HIDScope MODSERIAL mbed QEI biquadFilter
Revision 30:4d3c2113cd93, committed 2015-10-13
- Comitter:
- ThomasBNL
- Date:
- Tue Oct 13 15:27:28 2015 +0000
- Parent:
- 29:601ab5fa6824
- Child:
- 31:4ddf83ff4295
- Commit message:
- calibratie min werkt (nog wait_sample toevoegen)
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 13 14:47:44 2015 +0000
+++ b/main.cpp Tue Oct 13 15:27:28 2015 +0000
@@ -15,8 +15,9 @@
MODSERIAL pc(USBTX,USBRX);
volatile bool control_go = false;
volatile bool sample = false;
+volatile bool control_go_cal= false;
Ticker control_tick;
-Ticker T1;
+Ticker cal_tick;
double n=0;
double minimum_L;
double EMG_L_min;
@@ -25,7 +26,8 @@
double c=0;
// [BIQUAD FILTERS] //
-int Fs = 512; // sampling frequency
+const int Fs = 512; // sampling frequency
+const double wait_sample=1/Fs;
const double low_b1 = 1.480219865318266e-04; //filter coefficients
const double low_b2 = 2.960439730636533e-04;
const double low_b3 = 1.480219865318266e-04;
@@ -51,6 +53,12 @@
led1 = 0;
}
+void ControlGo_cal() //Control flag
+{
+ control_go_cal = true;
+ led1 = 0;
+}
+
void take_sample() //Control flag
{
if(n==25)
@@ -92,14 +100,9 @@
pc.printf("start minimum calibration in 5 seconds \n\r");
countdown_from_5();
c=0;
- next_measure_L_min:
- if(c<2560)
+
+ while(c<2560)
{
- while(1)
- {
- if(control_go);
- {
- control_go=false;
Filter();
minimum_L=y1+minimum_L;
scope.set(0,u1);
@@ -107,9 +110,7 @@
scope.set(2,minimum_L);
scope.send();
c++;
- goto next_measure_L_min;
- }
- }
+ wait((0.002));
}
pc.printf("Finished minimum calibration \n\r");
EMG_L_min=minimum_L/2560;
@@ -124,7 +125,7 @@
{
while(1)
{
- if(control_go);
+ if(control_go_cal);
{
control_go=false;
Filter();
