Projectgroep 20 Biorobotics / Mbed 2 deprecated opdrachtweek3hardware

Dependencies:   HIDScope MODSERIAL mbed

Files at this revision

API Documentation at this revision

Comitter:
Miriam
Date:
Thu Sep 21 09:46:20 2017 +0000
Child:
1:3fa4c465927e
Child:
2:30f6f422c00d
Commit message:
Slide programmatje

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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HIDScope.lib	Thu Sep 21 09:46:20 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/tomlankhorst/code/HIDScope/#d23c6edecc49
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Sep 21 09:46:20 2017 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include "HIDScope.h"
+
+HIDScope scope(2); // We're going to send 2 chennels of data
+Ticker AInTicker;
+AnalogIn aIn1(A0);
+
+volatile float x;
+volatile float x_prev=0;
+volatile float y; //filtered 'output' of ReadAnalogInAndFilter
+
+void ReadAnalogInAndFilter()
+{
+    x=aIn1; // Capture data
+    scope.set(0,x); //store data in first element of scope memory
+    y=(x_prev +x)/2.0; //averaging filter
+    scope.set(1,y); // stor data in second element of scope memory
+    x_prev=x; //Prepare for next round
+    
+    scope.send(); // send what's in the scope memory to PC
+    
+}
+
+int main ()
+{
+    AInTicker.attach(&ReadAnalogInAndFilter, 0.01);
+    while (true)
+    {/* do nothing. You could y here if you wish */};
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Sep 21 09:46:20 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/675da3299148
\ No newline at end of file