Group 2 PES tuttorial 3 led werkt niet met pot

Dependencies:   FastPWM MODSERIAL mbed HIDScope

Revision:
1:b7fafbf4aa28
Parent:
0:5776e1ab09bd
--- 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