Lars van der Hoeven / Mbed 2 deprecated motorshield_01

Dependencies:   MODSERIAL mbed HIDScope

Files at this revision

API Documentation at this revision

Comitter:
VRRangel
Date:
Wed Oct 17 09:06:16 2018 +0000
Parent:
1:f75a3567978c
Commit message:
inclusief code emg;

Changed in this revision

HIDScope.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f75a3567978c -r fa2cc8d8e100 HIDScope.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HIDScope.lib	Wed Oct 17 09:06:16 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/tomlankhorst/code/HIDScope/#d23c6edecc49
diff -r f75a3567978c -r fa2cc8d8e100 main.cpp
--- a/main.cpp	Wed Oct 17 08:12:59 2018 +0000
+++ b/main.cpp	Wed Oct 17 09:06:16 2018 +0000
@@ -1,15 +1,21 @@
 #include "mbed.h"
 #include "MODSERIAL.h"
+#include "HIDScope.h"
 
 
 PwmOut Motor2PWR(D5);
 DigitalOut Motor2DIR(D4);
 PwmOut Motor1PWR(D6);
 DigitalOut Motor1DIR(D7);
-AnalogIn Pot1(PTB2);
-AnalogIn Pot2(PTB3);
+AnalogIn emg0(A0);
+AnalogIn emg1(A1);
+AnalogIn emg2(A2);
+AnalogIn Pot1(A4);
+AnalogIn Pot2(A5);
 MODSERIAL pc(USBTX, USBRX);
 
+
+
 float x = 0;
 float y = 0;
 int main()
@@ -38,5 +44,29 @@
         Motor2DIR = x > 0.0f;
         wait(0.1f);
     }
+    
+    
     return(0);
+}
+
+HIDScope scope(3); 
+Ticker scopeTimer;
+
+float biceps_ra = 0.0;
+float biceps_la = 0.0;
+float triceps_ra = 0.0;
+
+void EMG_Read()
+{
+    biceps_ra = emg0.read();
+    pc.printf("%f ", biceps_ra);
+}
+
+void sample()
+{ 
+    scope.set(0, emg0.read() );
+    scope.set(1, emg1.read() );
+    scope.set(2, emg2.read() );
+  
+    scope.send();
 }
\ No newline at end of file