Servo controller

Dependencies:   Servo mbed

Files at this revision

API Documentation at this revision

Comitter:
peterknoben
Date:
Fri Oct 20 09:34:24 2017 +0000
Commit message:
Servo controller

Changed in this revision

Servo.lib Show annotated file Show diff for this revision Revisions of this file
main.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	Fri Oct 20 09:34:24 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/Servo/#36b69a7ced07
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Oct 20 09:34:24 2017 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+#include "Servo.h"
+
+//------------------------------------------------------------------------------
+//------------------------------Servo Setup-------------------------------------
+//------------------------------------------------------------------------------
+
+Servo MyServo(D9);
+InterruptIn But1(PTA4);
+int k=0;
+
+//------------------------------------------------------------------------------
+//---------------------------Servo Controller-----------------------------------
+//------------------------------------------------------------------------------
+
+void servo_control (){
+    if (k==0){
+        MyServo = 0;
+        k=1;
+    }
+    else{
+        MyServo = 2;
+        k=0;
+        }
+}
+
+//------------------------------------------------------------------------------
+//-------------------------------Main Loop--------------------------------------
+//------------------------------------------------------------------------------
+
+int main()
+{
+    But1.rise(&servo_control);
+    while (1) {}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Oct 20 09:34:24 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b484a57bc302
\ No newline at end of file