Script voor het weergeven van 1 EMG signaal met behulp van een OLIMEX shield. Let hierbij goed op dat je de juiste pinnetjes op het OLIMEX shield verbonden hebt, in dit geval A0 als uitgang. Verder maken we gebruik van 3,3 Volt!
Fork of EMG by
Revision 21:c418b6e8196b, committed 2017-10-12
- Comitter:
- Annelotte
- Date:
- Thu Oct 12 13:14:42 2017 +0000
- Parent:
- 20:97059009a491
- Commit message:
- Script voor het weergeven van 1 EMG signaal met behulp van het OLIMEX shield. Zorg hierbij dat de pinnetjes goed geplaatst zijn op het OLIMEX shield, uitgang A0 moet verbonden zijn en we werken met 3,3 Volt!
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 97059009a491 -r c418b6e8196b main.cpp --- a/main.cpp Thu Sep 22 08:53:50 2016 +0000 +++ b/main.cpp Thu Oct 12 13:14:42 2017 +0000 @@ -2,13 +2,14 @@ #include "HIDScope.h" //Define objects -AnalogIn emg0( A0 ); -AnalogIn emg1( A1 ); +AnalogIn emg0( A0 ); //Dit zijn de EMG signalen die binnen komen, bv. de ground en een signaal +//AnalogIn emg1( A1 ); -Ticker sample_timer; -HIDScope scope( 2 ); +Ticker sample_timer; //Leest de analog input en verplaatst deze naar de HIDScope +HIDScope scope( 1 ); DigitalOut led(LED1); + /** Sample function * this function samples the emg and sends it to HIDScope **/ @@ -16,7 +17,8 @@ { /* Set the sampled emg values in channel 0 (the first channel) and 1 (the second channel) in the 'HIDScope' instance named 'scope' */ scope.set(0, emg0.read() ); - scope.set(1, emg1.read() ); + //scope.set(1, emg1.read() ); + /* Repeat the step above if required for more channels of required (channel 0 up to 5 = 6 channels) * Ensure that enough channels are available (HIDScope scope( 2 )) * Finally, send all channels to the PC at once */ @@ -30,7 +32,7 @@ /**Attach the 'sample' function to the timer 'sample_timer'. * this ensures that 'sample' is executed every... 0.002 seconds = 500 Hz */ - sample_timer.attach(&sample, 0.002); + sample_timer.attach(&sample, 0.002); //Elke 0.002 seconde wordt er dus een signaal gegeven aan de HIDScope. Je kunt met deze ticker dus 250Hz als maximale frequentie (range) meten (want anderss aliasing). /*empty loop, sample() is executed periodically*/ while(1) {}
diff -r 97059009a491 -r c418b6e8196b mbed.bld --- a/mbed.bld Thu Sep 22 08:53:50 2016 +0000 +++ b/mbed.bld Thu Oct 12 13:14:42 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/abea610beb85 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/aae6fcc7d9bb \ No newline at end of file