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

Dependencies:   mbed QEI Servo HIDScope biquadFilter MODSERIAL FastPWM

Files at this revision

API Documentation at this revision

Comitter:
IsaRobin
Date:
Tue Oct 29 20:58:26 2019 +0000
Parent:
3:f30c2ded1a58
Child:
5:e21d303d62d8
Commit message:
final versie van dinsdag avond voor de servo motor;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Oct 29 20:33:45 2019 +0000
+++ b/main.cpp	Tue Oct 29 20:58:26 2019 +0000
@@ -1,33 +1,29 @@
-/* servo motor program - biorbotics groep 8 */
+/* servo motor program - biorbotics group 8 */
 
 #include <Servo.h>
 #include <mbed.h>
 #include <math.h>    /* cos */
 #include <MODSERIAL.h>
 
-
-
-MODSERIAL pc(USBTX, USBRX);
-Servo myservo(D3);
-
+MODSERIAL pc(USBTX, USBRX); //connect pc
+Servo myservo(D3); //the servo motor is connected to pin D3 on the BioRobotics shield
 
-//Buttons
-InterruptIn button2(SW2);
-InterruptIn button3(SW3);
+//Buttons that will be used to control the servo motor
+InterruptIn button2(SW2); //when this button is pushed, the servo motor rotates 90 degrees counterclockwise
+InterruptIn button3(SW3); //when this button is pushed, the servo motor rotates 90 degrees clockclockwise
 
-
-void kantelheen()
+void showcard()
 {
 
     myservo.SetPosition(2000);
-    pc.printf("heeft gekanteld heen.\n.\r");
+    pc.printf("card is being showed to user.\n.\r");
    
 }
 
-void kantelterug()
+void hidecard()
 {
     myservo.SetPosition(1000);
-    pc.printf("heeft terug gekanteld .\n.\r");
+    pc.printf("card is being rotated away from user .\n.\r");
     
 }
 
@@ -37,31 +33,17 @@
     pc.printf("starting main .\r.\n");
     myservo.Enable(1000,20000);
 
-    button2.rise(kantelheen);
-    button3.rise(kantelterug);
+    button2.rise(showcard);
+    button3.rise(hidecard);
 
     while(true) {
-        pc.printf("weer begonnen aan mijn main");
+        pc.printf("weer begonnen aan mijn main"); //@Jasper hebben we deze nog echt nodgi
         wait(2);
 
-
     }
 }
-/*        pc.printf("starting.\r.\n");
-
-        for (int pos = 1410; pos < 1590; pos += 5) {
-            myservo.SetPosition(pos);
-            wait_ms(20);
-        }
-        pc.printf("kant 1.\r.\n");
-        for (int pos = 1590; pos > 1410; pos -= 5) {
-            myservo.SetPosition(pos);
-            wait_ms(20);
-        }
-        pc.printf("kant 2.\r.\n");
-    }
-*/
 
 
 
 
+