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 QEI biquadFilter mbed
Fork of Project_script_union_final by
Revision 19:466ada92bf65, committed 2018-10-22
- Comitter:
- MarijkeZondag
- Date:
- Mon Oct 22 12:57:28 2018 +0000
- Parent:
- 18:898f54c6aa3d
- Child:
- 20:bd9495b31f50
- Commit message:
- hidscope werkend hopelijk;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Oct 22 12:48:44 2018 +0000
+++ b/main.cpp Mon Oct 22 12:57:28 2018 +0000
@@ -25,6 +25,10 @@
MODSERIAL pc(USBTX, USBRX);
+//HIDscope
+Ticker sample_timer;
+HIDScope scope( 2 );
+DigitalOut led(LED1);
//Global variables
int encoder = 0; //Starting point encoder
@@ -72,6 +76,19 @@
Ticker MovAg_tick;
//Functions
+void sample()
+{
+ /* 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_in.read() );
+ scope.set(1, emg1_in.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 */
+ scope.send();
+ /* To indicate that the function is working, the LED is toggled */
+ led = !led;
+}
+
void EMGFilter0()
{
double emg0 = emg0_in.read();
@@ -280,6 +297,7 @@
{
//pc.baud(115200);
//pc.printf("hello\n\r");
+ sample_timer.attach(&sample, 0.002);
ledr = 0; //Begin led = red, first state of calibration
ledb = 1;
@@ -354,4 +372,5 @@
}
}
+ while(1) {}
}
