Steering Servo Step responses

Dependencies:   FRDM-TFC mbed

Files at this revision

API Documentation at this revision

Comitter:
oj3g13
Date:
Thu Nov 24 10:39:45 2016 +0000
Commit message:
Mbed initialises servos, waits 3 seconds, moves servo to different PWM values at random time intervals

Changed in this revision

FRDM-TFC.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/FRDM-TFC.lib	Thu Nov 24 10:39:45 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/emh203/code/FRDM-TFC/#24430a0d7fd8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 24 10:39:45 2016 +0000
@@ -0,0 +1,62 @@
+#include "mbed.h"
+#include "TFC.h"
+#define MULTIPLIER 0.25
+
+DigitalOut gpo(D0);
+
+int main()
+{
+        TFC_Init();
+        TFC_InitServos(0.00052,0.00122,0.02);
+        float i;
+        wait(3);
+        float rand_max=RAND_MAX;
+        while(true)
+        {
+        i = (rand()/rand_max)*MULTIPLIER;
+        
+
+
+        
+        gpo = !gpo; // toggle pin 
+        TFC_SetServo(0,-1.0);
+        wait(i);
+        i = (rand()/rand_max)*MULTIPLIER;
+        
+        gpo = !gpo; 
+        TFC_SetServo(0,0.4);
+        wait(i);
+        i = (rand()/rand_max)*MULTIPLIER;
+                
+        gpo = !gpo; 
+        TFC_SetServo(0,0);
+        wait(i);
+        i = (rand()/rand_max)*MULTIPLIER;
+                
+        gpo = !gpo; 
+        TFC_SetServo(0,-0.6);
+        wait(i);
+        i = (rand()/rand_max)*MULTIPLIER;
+                
+        gpo = !gpo; 
+        TFC_SetServo(0,-0.5);
+        wait(i);
+        i = (rand()/rand_max)*MULTIPLIER;
+                
+        gpo = !gpo; 
+        TFC_SetServo(0,-0.7);
+        wait(i);
+        i = (rand()/rand_max)*MULTIPLIER;
+                
+        gpo = !gpo; 
+        TFC_SetServo(0,0.9);
+        wait(i);
+        i = (rand()/rand_max)*MULTIPLIER;
+
+        gpo = !gpo; 
+        TFC_SetServo(0,0.5);
+        wait(i);
+        i = (rand()/rand_max)*MULTIPLIER;
+
+        }   
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 24 10:39:45 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0ab6a29f35bf
\ No newline at end of file