William McColl / Mbed 2 deprecated Balanced-Arm

Dependencies:   MCP23017 WattBob_TextLCD mbed

Fork of Balanced Arm by Balanced Arm

Files at this revision

API Documentation at this revision

Comitter:
wm70
Date:
Wed Feb 03 14:10:51 2016 +0000
Parent:
14:3be8ca0c066d
Child:
16:585f8b5abc2c
Commit message:
Torque working

Changed in this revision

PC_Comms/PC_Comms.cpp Show annotated file Show diff for this revision Revisions of this file
Robotic_Control/Robotic_Control.h Show annotated file Show diff for this revision Revisions of this file
Robotic_Control/Robotic_control.cpp 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
--- a/PC_Comms/PC_Comms.cpp	Wed Feb 03 13:58:54 2016 +0000
+++ b/PC_Comms/PC_Comms.cpp	Wed Feb 03 14:10:51 2016 +0000
@@ -78,16 +78,16 @@
             switch(Command[2])
             {
                 case '0':
-                    char angle[3];
-                    angle[0] = Command[4];
-                    angle[1] = Command[5];
-                    angle[2] = Command[6];
-                    int angle2 = atoi(angle);
-                    lcd->cls();
-                    lcd->printf("%i", angle2);
-                    wait(1);
-                    my_AX12.SetGoal(angle2);
-                    break;
+//                    char angle[3];
+//                    angle[0] = Command[4];
+//                    angle[1] = Command[5];
+//                    angle[2] = Command[6];
+//                    int angle2 = atoi(angle);
+//                    lcd->cls();
+//                    lcd->printf("%i", angle2);
+//                    wait(1);
+//                    my_AX12.SetGoal(angle2);
+//                    break;
                 default:
                     break;
             }
@@ -109,10 +109,10 @@
     lcd->cls();
     lcd->printf("%i", data);
     wait(5);
-    _returnToPC[0] = 'S';
-    _returnToPC[1] = 'D';
-    _returnToPC[2] = '0';
-    _returnToPC[3] = _servo;
+//    _returnToPC[0] = 'S';
+//    _returnToPC[1] = 'D';
+//    _returnToPC[2] = '0';
+//    _returnToPC[3] = _servo;
 //    _returnToPC[4] = '0';
 //    _returnToPC[5] = '0';
 //    _returnToPC[6] = '0';
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Robotic_Control/Robotic_Control.h	Wed Feb 03 14:10:51 2016 +0000
@@ -0,0 +1,19 @@
+#ifndef Robotic_Control_H
+#define Robotic_Control_H
+
+#include <string>
+#include "mbed.h"
+#include "WattBob_TextLCD.h"
+#include "AX12.h"
+
+class PC_Comms
+{
+    
+public:
+
+
+    
+private:
+    
+};
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Robotic_Control/Robotic_control.cpp	Wed Feb 03 14:10:51 2016 +0000
@@ -0,0 +1,27 @@
+//*********************************************************************
+// Author: 
+// File: 
+// Version: 
+// Date: 
+//*********************************************************************
+
+#include <string>
+#include "PC_Comms.h"
+#include "mbed.h"
+#include "MCP23017.h"
+#include "WattBob_TextLCD.h"
+#include "AX12.h"
+
+Robotic_Control::SetServoPos(int servo, int position){
+             char angle[3];
+                   angle[0] = Command[4];
+                   angle[1] = Command[5];
+                   angle[2] = Command[6];
+                   int angle2 = atoi(angle);
+                   lcd->cls();
+                   lcd->printf("%i", angle2);
+                   wait(1);
+                   my_AX12.SetGoal(angle2);
+                    break;
+    
+    }
--- a/main.cpp	Wed Feb 03 13:58:54 2016 +0000
+++ b/main.cpp	Wed Feb 03 14:10:51 2016 +0000
@@ -3,6 +3,14 @@
 #include "mbed.h"
 #include "PC_Comms.h"
 
+    
+    MCP23017 *par_port;
+    WattBob_TextLCD *lcd;
+    Serial ax12_bus(p28, p27);
+    Serial _PCbus(USBTX, USBRX);
+    AX12 my_AX12(ax12_bus, _PCbus, p29, 1);
+
+
 PC_Comms HShake;
 
 float position;