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: MODSERIAL mbed Encoder
Revision 2:3dab90d3aac2, committed 2013-10-16
- Comitter:
- Socrates
- Date:
- Wed Oct 16 08:53:57 2013 +0000
- Parent:
- 1:34202d107458
- Child:
- 3:935347ab4e12
- Commit message:
- Voor opschonen
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 15 19:51:13 2013 +0000
+++ b/main.cpp Wed Oct 16 08:53:57 2013 +0000
@@ -22,14 +22,15 @@
y1=0;
z1=0;
yabs1=0;
- numh1=0;
- numh2=0;
- denh1=0;
- denh2=0;
- numl1=0;
- numl2=0;
- denl1=0;
- denl2=0;
+
+ numh1=0.996868235770807;
+ numh2=-0.996868235770807;
+ //denh1=1;
+ denh2=-0.993736471541615;
+ numl1=0.006244035046343;
+ numl2=-0.006244035046343;
+ //denl1=1;
+ denl2=-0.987511929907314;
pc.baud(115200);
while(1) {
@@ -37,17 +38,26 @@
looptimerflag = false;
k=emg.read();
x=(k-0.5)*2.0;
-
+
//High pass, 1 Hz
- y=(y1/1.000994230391224-(0.996868235770807/1.000994230391224)*x1+(0.997865599482850/1.000994230391224)*x);
-
+ //Waarom heb ik geen - gebruikt bij y1/denh2?
+ //y=(y1/1.000994230391224-(0.996868235770807/1.000994230391224)*x1+(0.997865599482850/1.000994230391224)*x);
+ //Met bovenstaande zijn de metingen gedaan.
+ //Dat is
+ //y=(y1/denh2-(numh1/denh2)*x1+(numh2/denh2)*x)
+ y=x*numh1+x1*numh2-y1*denh2;
//Rectify
yabs=abs(y);
//Low pass, 1 Hz
- z=(z1/1.000987999680353-(0.006244035046343/1.000987999680353)*yabs1+(0.006237787927252/1.000987999680353)*yabs);
+ //Waarom heb ik geen - gebruikt bij z1/denl2?
+ //z=(z1/1.000987999680353-(0.006244035046343/1.000987999680353)*yabs1+(0.006237787927252/1.000987999680353)*yabs);
+ //Met bovenstaande zijn de metingen gedaan.
+ //Dat is
+ //z=(z1/denl2-(numl1/denl2)*y1+(numl2/denl2)*y)
+ z=y*numl1+y1*numl2-z1*denl2;
- pc.printf("%f\n\r",yabs);
+ pc.printf("%f\n\r",z);
x1=x;
y1=y;
z1=z;
