servo motor werkt eindelijk!!!! wiehoe!!!

Dependencies:   mbed QEI Servo HIDScope biquadFilter MODSERIAL FastPWM

Revision:
3:f30c2ded1a58
Parent:
2:f92eadfd1a27
Child:
4:d3e8ec68ff97
--- a/main.cpp	Tue Oct 29 19:44:11 2019 +0000
+++ b/main.cpp	Tue Oct 29 20:33:45 2019 +0000
@@ -6,21 +6,49 @@
 #include <MODSERIAL.h>
 
 
+
 MODSERIAL pc(USBTX, USBRX);
+Servo myservo(D3);
+
+
+//Buttons
+InterruptIn button2(SW2);
+InterruptIn button3(SW3);
 
 
-Servo myservo(D3);
+void kantelheen()
+{
 
+    myservo.SetPosition(2000);
+    pc.printf("heeft gekanteld heen.\n.\r");
+   
+}
+
+void kantelterug()
+{
+    myservo.SetPosition(1000);
+    pc.printf("heeft terug gekanteld .\n.\r");
+    
+}
 
 int main()
 {
     pc.baud(115200);
     pc.printf("starting main .\r.\n");
-    myservo.Enable(1410,20000);
+    myservo.Enable(1000,20000);
+
+    button2.rise(kantelheen);
+    button3.rise(kantelterug);
 
     while(true) {
-        pc.printf("starting.\r.\n");
-        
+        pc.printf("weer begonnen aan mijn main");
+        wait(2);
+
+
+    }
+}
+/*        pc.printf("starting.\r.\n");
+
         for (int pos = 1410; pos < 1590; pos += 5) {
             myservo.SetPosition(pos);
             wait_ms(20);
@@ -32,8 +60,8 @@
         }
         pc.printf("kant 2.\r.\n");
     }
-
-}
+*/
 
 
 
+