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 MODSERIAL TextLCD mbed-dsp mbed
Fork of EMGmeten by
Revision 0:b68a6d0451b8, committed 2014-10-28
- Comitter:
- lauradeheus
- Date:
- Tue Oct 28 14:23:05 2014 +0000
- Child:
- 1:b7a9fcf50776
- Commit message:
- Bandpass goedwerkend
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/EMGmeten.cpp Tue Oct 28 14:23:05 2014 +0000
@@ -0,0 +1,47 @@
+#include "mbed.h"
+#include "HIDScope.h"
+
+#include "arm_math.h"
+
+AnalogIn emg(PTB1); //Analog input
+HIDScope scope(2);
+
+arm_biquad_casd_df1_inst_f32 lowpass;
+arm_biquad_casd_df1_inst_f32 highpass;
+float lowpass_const[] = {0.978030479206560 , 1.956060958413119 , 0.978030479206560 , -1.955578240315036 , -0.956543676511203};
+float lowpass_states[4];
+float highpass_const[] = {0.638945525159022, -1.277891050318045, 0.638945525159022 , 1.142980502539901 , -0.412801598096189};
+float highpass_states[4];
+
+void looper()
+{
+ uint16_t emg_value;
+ float filtered_emg;
+ float emg_value_f32;
+ emg_value = emg.read_u16(); // read direct ADC result, converted to 16 bit integer (0..2^16 = 0..65536 = 0..3.3V)
+ emg_value_f32 = emg.read();
+
+ arm_biquad_cascade_df1_f32(&highpass, &emg_value_f32, &filtered_emg, 1 );
+ arm_biquad_cascade_df1_f32(&lowpass, &filtered_emg, &filtered_emg, 1 );
+
+ scope.set(0,emg_value); //uint value
+ scope.set(1,filtered_emg); //processed float
+ scope.send();
+}
+
+int main()
+{
+ Ticker log_timer;
+
+ arm_biquad_cascade_df1_init_f32(&lowpass,1 , lowpass_const, lowpass_states);
+ arm_biquad_cascade_df1_init_f32(&highpass,1 , highpass_const, highpass_states);
+
+ log_timer.attach(looper, 0.005);
+
+ while(1) //Loop
+ {
+ /*Empty!*/
+ /*Everything is handled by the interrupt routine now!*/
+ }
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HIDScope.lib Tue Oct 28 14:23:05 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tomlankhorst/code/HIDScope/#e44574634162
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-dsp.lib Tue Oct 28 14:23:05 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/mbed-official/code/mbed-dsp/#7a284390b0ce
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 28 14:23:05 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013 \ No newline at end of file
