mag niet van hendrik D:

Dependencies:   mbed MatrixMath QEI HIDScope Matrix biquadFilter MODSERIAL FastPWM

Files at this revision

API Documentation at this revision

Comitter:
Hendrikvg
Date:
Tue Sep 10 15:03:50 2019 +0000
Parent:
1:b862262a9d14
Child:
3:68d78770639b
Commit message:
Rood knippert, blauw en groen kunnen aan gezet worden

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Sep 04 15:30:13 2019 +0000
+++ b/main.cpp	Tue Sep 10 15:03:50 2019 +0000
@@ -1,23 +1,32 @@
 #include "mbed.h"
-//#include "HIDScope.h"
-//#include "QEI.h"
 #include "MODSERIAL.h"
-//#include "BiQuad.h"
-//#include "FastPWM.h"
-
-DigitalOut led(LED_RED);
 
 MODSERIAL pc(USBTX, USBRX);
+DigitalOut led(LED_RED);
+Ticker ReadEnCoder;
+
+volatile char color='r';
+
+void knipper()
+{
+    led = !led;
+}
 
 int main()
 {
     pc.baud(115200);
-    pc.printf("\r\nStarting...\r\n\r\n");
-    
-    while (true) {
-        
-        led = !led;
-        
-        wait_ms(500);
+    ReadEnCoder.attach(knipper,0.05);
+    while (true) 
+    {
+        color = pc.getc();
+        if (color == 'r'){
+            DigitalOut led(LED_RED);
+            }
+        if (color == 'g'){
+            DigitalOut led(LED_GREEN);
+            }
+        if (color == 'b'){
+            DigitalOut led(LED_BLUE);
+            }
     }
-}
+}
\ No newline at end of file