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: HIDScope biquadFilter mbed
Diff: main.cpp
- Revision:
- 1:16165e207e70
- Parent:
- 0:2ded24549b70
- Child:
- 2:e3259334299e
diff -r 2ded24549b70 -r 16165e207e70 main.cpp
--- a/main.cpp Thu Oct 15 14:39:52 2015 +0000
+++ b/main.cpp Thu Oct 15 14:55:16 2015 +0000
@@ -1,10 +1,14 @@
#include "mbed.h"
#include "HIDScope.h"
+AnalogIn EMG(A0);
+HIDScope scope (3);
+
// Standaard formule voor het biquad filter
double biquad(double u, double &v1, double &v2, const double a1, const double a2, const double b0, const double b1, const double b2)
{
+ u = EMG.read();
double v = u - a1*v1 - a2*v2;
double y = b0*v + b1*v1 + b2*v2;
v2=v1;
@@ -47,11 +51,21 @@
biquad (u, fno3_v1, fno3_v2, fno3_a1, fno3_a2, fno3_b0, fno3_b1, fno3_b2);
}
+// HIDScope
+Ticker timer;
+void signal (){
+ scope.set (0, Highpass_filter);
+ scope.set (0, Lowpass_filter);
+ scope.set (0, Notch_filter);
+ scope.send ();
+ }
+
int main ()
{
FHIGH.attach_us(Highpass_filter, 1e4);
FLOW.attach_us(Lowpass_filter, 1e4);
FNOTCH.attach_us (Notch_filter, 1e4);
+ timer.attach_us (signal, 1e4);
}