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: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 25:832b26afbe0b
- Parent:
- 24:a9ec9b836fd9
--- a/main.cpp Mon Oct 21 15:11:14 2019 +0000
+++ b/main.cpp Fri Oct 25 09:46:54 2019 +0000
@@ -71,7 +71,6 @@
int muscle;
float sum = 0;
-float rest_value;
float rest_value_bl;
float rest_value_br;
float rest_value_leg;
@@ -204,37 +203,35 @@
{
sum = sum + emg;
n++;
- rest_value = float (sum/n);
rest_timeout.attach(rest,0.01f);
}
if (n == 50)
{
sum = sum + emg;
n++;
- rest_value = float (sum/n);
- n = 0;
- sum = 0;
if (muscle == 0)
{
- rest_value_bl = rest_value;
+ rest_value_bl = float (sum/n);
CurrentSubstate = mvc_biceps_left;
SubstateChanged = true;
led_red = 1;
}
if (muscle == 2)
{
- rest_value_br = rest_value;
+ rest_value_br = float (sum/n);
CurrentSubstate = mvc_biceps_right;
SubstateChanged = true;
led_red = 1;
}
if (muscle == 4)
{
- rest_value_leg = rest_value;
+ rest_value_leg = float (sum/n);
CurrentSubstate = mvc_biceps_leg;
SubstateChanged = true;
led_red = 1;
}
+ n = 0;
+ sum = 0;
}
}