not checked because compiler was down, but this should do everything!!!!

Dependencies:   FastPWM HIDScope MODSERIAL QEI biquadFilter mbed

Fork of EMG4 by Remi van Veen

Revision:
19:2bf824669684
Parent:
18:21d8e7a81cf5
Child:
20:97059009a491
--- a/main.cpp	Thu Sep 22 08:04:14 2016 +0000
+++ b/main.cpp	Thu Sep 22 08:36:00 2016 +0000
@@ -2,9 +2,11 @@
 #include "HIDScope.h"
 
 //Define objects
-AnalogIn    emg(A0); //Analog input
+AnalogIn    emg0( A0 );
+AnalogIn    emg1( A1 );
+
 Ticker      sample_timer;
-HIDScope    scope(1);
+HIDScope    scope( 2 );
 DigitalOut  led(LED1);
 
 /** Sample function
@@ -12,11 +14,11 @@
  **/
 void sample()
 {
-    /* First, sample the EMG using the 'read' method of the 'AnalogIn' variable named 'emg' */
-    double emg_value = emg.read();
-    /* Second, set the sampled emg value in channel zero (the first channel) in the 'HIDScope' variable named 'scope' */
-    scope.set(0,emg_value);
-    /* Repeat the step above if required for more channels (channel 0 up to 5 = 6 channels) */
+    /* 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 */
@@ -24,11 +26,11 @@
 }
 
 int main()
-{
+{   
     /**Attach the 'sample' function to the timer 'sample_timer'.
-    * this ensures that 'sample' is executed every... 0.01 seconds
+    * this ensures that 'sample' is executed every... 0.002 seconds = 500 Hz
     */
-    sample_timer.attach(&sample, 0.01);
+    sample_timer.attach(&sample, 0.002);
 
     /*empty loop, sample() is executed periodically*/
     while(1) {}