Group 2 PES tuttorial 3 led werkt niet met pot

Dependencies:   FastPWM MODSERIAL mbed HIDScope

Files at this revision

API Documentation at this revision

Comitter:
Roooos
Date:
Tue Sep 25 13:20:22 2018 +0000
Parent:
0:5776e1ab09bd
Commit message:
HIDScope_Probeersel;

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 5776e1ab09bd -r b7fafbf4aa28 HIDScope.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HIDScope.lib	Tue Sep 25 13:20:22 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/tomlankhorst/code/HIDScope/#d23c6edecc49
diff -r 5776e1ab09bd -r b7fafbf4aa28 main.cpp
--- a/main.cpp	Tue Sep 18 15:32:20 2018 +0000
+++ b/main.cpp	Tue Sep 25 13:20:22 2018 +0000
@@ -1,22 +1,32 @@
 #include "mbed.h"
 #include "MODSERIAL.h"
 #include "FastPWM.h"
+#include "HIDScope.h"
 
-DigitalOut ledmbed(LED_RED);
-FastPWM led(D8);
-InterruptIn butt1(D2);
-InterruptIn butt2(D12);
+//DigitalOut ledmbed(LED_RED);
+//FastPWM led(D8);
+//InterruptIn butt1(D2);
+//InterruptIn butt2(D12);
 AnalogIn potter(A5);
 
 MODSERIAL pc(USBTX, USBRX);
 
+HIDScope scope(1); // We’re going to send 2 channels of data
+Ticker Tikkie;
+
+volatile float brightness;
+volatile float brightness_prev = 0;
+
+void ReadPot()
+{
+    brightness = potter;
+    scope.set(0, brightness);
+    brightness_prev = brightness;
+    scope.send();
+}
 
 int main()
-{   led = 1;
-    ledmbed = 0;
-    wait(2); 
-    while (true) { 
-        led = potter;
-        wait (0.1); 
-    } 
+{
+    Tikkie.attach(&ReadPot,0.01);
+    while (true) {};        
 }
\ No newline at end of file