lighthouse

Dependencies:   RobotArmController SerialHalfDuplex mbed

Fork of PR_RobotArm by James Hilder

Revision:
0:ba8a9d66892d
Child:
2:55f39e7883a6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Feb 16 23:58:59 2017 +0000
@@ -0,0 +1,41 @@
+#include "robotarm.h"
+
+Robotarm arm;
+
+int main()
+{
+    wait(1); // Useful if you need to connect H-Term etc.
+    //Run the main initialisation routine
+    arm.init();
+    //Reset the servos to center position (after 1 second delay)
+    //NB This activates the servos (makes rigid) so be careful when using
+    arm.zero_servos(1);
+    //Wait till servos are zeroed
+    wait(3);
+    //Initialise remote control
+    if(REMOTE_ENABLED == 1)remote.init();
+    
+    //User code can now go in a loop:
+    while(1) {
+        //Eg set all servos to 1948 then 2148
+          servo.SetGoal(BASE,1948,1);
+          servo.SetGoal(SHOULDER,1948,1);
+          servo.SetGoal(ELBOW,1948,1);
+          servo.SetGoal(WRIST,400,1);
+            //If you want to show detailed info about a servo over serial, use the following:
+            //servo.DebugData(WRIST);
+          wait(0.5);
+          servo.SetGoal(BASE,2148,1);
+          servo.SetGoal(SHOULDER,2148,1);
+          servo.SetGoal(ELBOW,2148,1);
+          servo.SetGoal(WRIST,600,1);
+          wait(0.5);
+            //Alternatively we can set all the servos then use trigger - observe the difference...
+            //servo.SetGoal(BASE,2148,0);
+            //servo.SetGoal(SHOULDER,2148,0);
+            //servo.SetGoal(ELBOW,2148,0);
+            //servo.SetGoal(WRIST,600,0);
+            //servo.trigger();
+            //wait(0.5);
+    }
+}
\ No newline at end of file