Wiesje Roskamp / Mbed 2 deprecated template_biorobotics_verbeterd

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

Files at this revision

API Documentation at this revision

Comitter:
WiesjeRoskamp
Date:
Fri Oct 11 06:59:23 2019 +0000
Parent:
1:b862262a9d14
Commit message:
Verbeterde template

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Sep 04 15:30:13 2019 +0000
+++ b/main.cpp	Fri Oct 11 06:59:23 2019 +0000
@@ -1,13 +1,31 @@
 #include "mbed.h"
-//#include "HIDScope.h"
+#include "HIDScope.h"
 //#include "QEI.h"
 #include "MODSERIAL.h"
 //#include "BiQuad.h"
 //#include "FastPWM.h"
 
+//Define objects
+AnalogIn    emg0( A0 );
+AnalogIn    emg1( A1 );
+
 DigitalOut led(LED_RED);
 
 MODSERIAL pc(USBTX, USBRX);
+HIDScope    scope( 2 );
+
+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.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 */
+    scope.send();
+    /* To indicate that the function is working, the LED is toggled */
+    led = !led;
+}
 
 int main()
 {
@@ -17,7 +35,7 @@
     while (true) {
         
         led = !led;
-        
+        sample();
         wait_ms(500);
     }
 }