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 mbed
Revision 0:7af8b67c64f8, committed 2017-09-21
- 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
--- /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