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 biquadFilter mbed
Fork of a_check_emg_filtered_without_cal by
main.cpp
- Committer:
- daniQQue
- Date:
- 2016-10-21
- Revision:
- 6:83358367e413
- Parent:
- 5:688b1b5530d8
- Child:
- 7:42d0e38196f1
File content as of revision 6:83358367e413:
//libraries
#include "mbed.h"
#include "HIDScope.h"
#include "biquadFilter.h"
//Define objects
AnalogIn emg0( A0 ); //analog in to get EMG in to c++
Ticker sample_timer; //ticker
HIDScope scope( 3); //open 3 channels in hidscope
DigitalOut led(LED_GREEN);
//define variables
double emg_0_value;
double emg_gefilterd;
double emg_abs
biquadFilter filterhigh1(-1.1430, 0.4128, 0.6389, -1.2779, 0.6389);
void filter(){
emg_0_value=emg0.read(); //read the emg value from the elektrodes
emg_gefilterd= filterhigh1.step(emg_0_value);
emg_abs=abs(emg_gefilterd);
led=!led;
//send signals to scope
scope.set(0, emg_0_value ); //set emg signal to scope in channel 1
scope.set(1, emg_gefilterd );
scope.set(2, emg_abs);
scope.send(); //send all the signals to the scope
}
//program
int main()
{
sample_timer.attach(&filter, 0.001); //continously execute the EMG reader and filter, it ensures that filter and sampling is executed every 1/frequency seconds
//endless loop
while(1)
{}
}
