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.
Fork of EMGStdevV3 by
Revision 1:1ffb9e3ae00f, committed 2013-11-04
- Comitter:
- DanAuhust
- Date:
- Mon Nov 04 13:26:18 2013 +0000
- Parent:
- 0:59e2ea255892
- Child:
- 2:56230ff9fc8f
- Child:
- 3:e609cd999fd2
- Commit message:
- Werkt nu
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Nov 03 20:18:17 2013 +0000
+++ b/main.cpp Mon Nov 04 13:26:18 2013 +0000
@@ -25,7 +25,7 @@
#define DEN3 -2.1689
#define DEN4 0.4531
-//lowpass filter constantes 4Hz 4e orde, Fs = 312,5 z
+//lowpass filter constantes 4Hz 4e orde, Fs = 312,5 Hz
#define NUM0_3 0.00000236 // constante
#define NUM1_3 0.00000944 // z^-1
#define NUM2_3 0.00001415 // z^-2etc.
@@ -63,12 +63,12 @@
if(count_biceps >= size)
count_biceps=0;
//sizeof(keeper_biceps)/sizeof(float);
- for(int i=0; i < (size-1); i++)
+ for(int i=0; i < size; i++)
{sum+=keeper_biceps[i];
}
mean=sum/size;
sum=0;
- for(int i=0; i < size-1; i++)
+ for(int i=0; i < size; i++)
{sum+=(keeper_biceps[i]-mean)*(keeper_biceps[i]-mean);
}
sig_out=sqrt(sum/size);
@@ -80,12 +80,12 @@
if(count_triceps==size)
count_triceps=0;
//sizeof(keeper_triceps) / sizeof(float);
- for(int i=0; i < size-1; i++){
+ for(int i=0; i < size; i++){
sum+=keeper_triceps[i];
}
mean=sum/size;
sum=0;
- for(int i=0; i < size-1; i++){
+ for(int i=0; i < size; i++){
sum+=(keeper_triceps[i]-mean)*(keeper_triceps[i]-mean);
}
sig_out=sqrt(sum/size);
@@ -283,7 +283,7 @@
//static int sig_count = 1;
emg_value_biceps=std_dev(filter(1),1);
emg_value_triceps=std_dev(filter(2),2);
-//dy = emg_value_biceps-emg_value_triceps;
+dy = emg_value_biceps-emg_value_triceps;
/*emg_value_flexoren = (100*filter(3)-44);
@@ -304,7 +304,7 @@
*/
//dy = emg_value_biceps-emg_value_triceps;
if(pc.rxBufferGetSize(0)-pc.rxBufferGetCount() > 30)
- pc.printf("%.6f, %.6f\n",emg_value_biceps, emg_value_triceps);
+ pc.printf("%.6f, %.6f, %.6f\n",emg_value_biceps, emg_value_triceps, dy);
/**When not using the LED, the above could also have been done this way:
* pc.printf("%.6\n", emg0.read());
*/
