Servo Motor

Dependencies:   Servo mbed

Files at this revision

API Documentation at this revision

Comitter:
maaikelaagland
Date:
Tue Oct 31 16:17:36 2017 +0000
Commit message:
Servo motor;

Changed in this revision

Servo.lib Show annotated file Show diff for this revision Revisions of this file
Servomotording.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.lib	Tue Oct 31 16:17:36 2017 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/simon/code/Servo/#36b69a7ced07
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servomotording.cpp	Tue Oct 31 16:17:36 2017 +0000
@@ -0,0 +1,32 @@
+
+#include "mbed.h"
+#include <Servo.h>
+
+
+Servo servo (D8); 
+DigitalIn button1 (D3); 
+DigitalIn button2(D9); 
+
+float range = 0.009;
+int main () {
+
+servo.calibrate(range, 90.0);
+
+while (true) {
+    if (button1 == 0) {
+       for(int i=25; i<75; i++) { // de eerste is is het minimum en de tweede het maximum. De range is van 0 tot 1 
+            servo = i/100.0;
+            wait(0.01); //hiermee kan dus de snelheid bepaald worden van de servo motor. Hoe hoger hoe trager
+        
+        }
+        
+    if (button2 == 0) {
+        for(int i=75; i>25; i--) { //hierbij is de eerste i het maximum en de tweede i het mininum 
+            servo = i/100.0;
+            wait(0.01);
+        }
+        }
+        
+}
+}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 31 16:17:36 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a330f0fddbec
\ No newline at end of file