1616 * Function 7 - 8 : attach or detach all servos (function 7-8)
1717 * Function 9 : uArm calibration
1818 * Function 10 : read current coordinate x,y,z
19- * Function 11 : recording mode
19+ * Function 11 : recording mode
2020
2121*/
2222
2727#include " uarm_library.h"
2828#include < Servo.h>
2929
30- // define a uArm
31- // uArmLibrary uArm;
32- int value; // value is the data recevied
30+ // define a uArm
31+ // uArmLibrary uArm;
32+ int value; // value is the data recevied
3333
3434void setup () {
35-
35+
3636 Wire.begin (); // join i2c bus (address optional for master)
3737 Serial.begin (9600 ); // start serial port at 9600 bps
3838}
@@ -45,85 +45,85 @@ void loop() {
4545
4646 char readSerial = Serial.read ();
4747 Serial.println (readSerial);
48-
48+
4949 // ---------------------------------- function 1 ------------------------------------
50- // function below is for move uArm from current position to absolute coordinate
51- // x = 13, y = -13, z = 3
52-
50+ // function below is for move uArm from current position to absolute coordinate
51+ // x = 13, y = -13, z = 3
52+
5353 if (readSerial == ' 1' ) {
5454 uarm.moveTo (13 ,-13 ,3 );
5555 delay (1000 );
5656 }
57-
57+
5858 // ---------------------------------- function 2 ------------------------------------
5959 // function below is for move uArm from current position to absolute coordinate
60- // x = -13, y = -13, z = 3
61-
60+ // x = -13, y = -13, z = 3
61+
6262 if (readSerial == ' 2' ) {
6363 uarm.moveTo (-13 ,-13 ,3 );
6464 delay (1000 );
6565 }
6666
6767 // ---------------------------------- function 3 ------------------------------------
68- // function below is for move uArm from current position to relatvie coordinate
69- // (dot) dx = 4, dy = -3, dz = 2 in 5 seconds
70-
68+ // function below is for move uArm from current position to relatvie coordinate
69+ // (dot) dx = 4, dy = -3, dz = 2 in 5 seconds
70+
7171 if (readSerial == ' 3' ) {
7272 uarm.moveTo (1 ,1 ,1 ,RELATIVE,2 );
7373 delay (1000 );
7474 }
75-
75+
7676 // ---------------------------------- function 4 ------------------------------------
77- // function below is for move uArm from current position to relatvie coordinate
78- // (dot) dx = -4, dy = 3, dz = -2 in 5 seconds
79-
77+ // function below is for move uArm from current position to relatvie coordinate
78+ // (dot) dx = -4, dy = 3, dz = -2 in 5 seconds
79+
8080 if (readSerial == ' 4' ) {
8181 uarm.moveTo (-4 ,3 ,-2 ,RELATIVE,5 );
8282 delay (1000 );
8383 }
84-
85- // ---------------------------------- function 5 ------------------------------------
86- // function below is for move uArm to draw a Rectangle with 10 cm long and 5 cm
87- // width in 2 seconds for one arm ( 8s totally)
88-
89- if (readSerial == ' 5' ) {
90- uarm.drawRec (10 ,5 ,2 );
91- delay (1000 );
92- }
9384
94- // ---------------------------------- function 6 ------------------------------------
95- // function below is for move uArm to draw a ellipse with 10 cm long and 10 cm
96- // width (circle) for full 360 degree in 2 seconds
97-
98- if (readSerial == ' 6' ) {
99- uarm.drawCur (6 ,6 ,360 ,2 );
100- delay (1000 );
101- }
85+ // ---------------------------------- function 5 ------------------------------------
86+ // function below is for move uArm to draw a Rectangle with 10 cm long and 5 cm
87+ // width in 2 seconds for one arm ( 8s totally)
88+
89+ // if (readSerial == '5') {
90+ // uarm.drawRec(10,5,2);
91+ // delay(1000);
92+ // }
93+ //
94+ // //---------------------------------- function 6 ------------------------------------
95+ // // function below is for move uArm to draw a ellipse with 10 cm long and 10 cm
96+ // // width (circle) for full 360 degree in 2 seconds
97+ //
98+ // if (readSerial == '6') {
99+ // uarm.drawCur(6,6,360,2);
100+ // delay(1000);
101+ // }
102102
103103 // ---------------------------------- function 7 ------------------------------------
104104 // function below is atach all servos
105-
106- if (readSerial == ' a' ) {
107- uarm.attachAll ();
108- }
105+
106+ // if (readSerial == 'a') {
107+ // uarm.attachAll();
108+ // }
109109
110110 // ---------------------------------- function 8 ------------------------------------
111111 // function below is detach all servos
112-
112+
113113 if (readSerial == ' d' ) {
114114 uarm.detachAll ();
115115 }
116-
116+
117117 // ---------------------------------- function 9 ------------------------------------
118118 // function below is for calibrate uArm
119-
119+
120120 // if (readSerial == 'c') {
121121 // calib.calibrations();
122122 // }
123-
123+
124124 // ---------------------------------- function 10 ------------------------------------
125- // function below is for print current x,y,z absolute location
126-
125+ // function below is for print current x,y,z absolute location
126+
127127 if (readSerial == ' g' ) {
128128 Serial.print (" The current location is " );
129129 Serial.print (uarm.getCalX ());
@@ -143,7 +143,7 @@ void loop() {
143143 Serial.print (" SERVO_RIGHT_NUM offset:" );
144144 Serial.println (uarm.readServoOffset (SERVO_RIGHT_NUM));
145145 Serial.print (" SERVO_HAND_ROT_NUM offset:" );
146- Serial.println (uarm.readServoOffset (SERVO_HAND_ROT_NUM));
146+ Serial.println (uarm.readServoOffset (SERVO_HAND_ROT_NUM));
147147 }
148148
149149 if (readSerial == ' o' ) {
@@ -153,16 +153,16 @@ void loop() {
153153 if (readSerial == ' f' ) {
154154 uarm.pumpOff ();
155155 }
156-
156+
157157 // ---------------------------------- function 11 ------------------------------------
158158 // function below is for record a 20 seconds trajactory for uArm
159159 // must put recordingMode in a loop
160-
160+
161161 // if (readSerial == 'r') {
162162 // while(1){
163163 // uArm.recordingMode(10);
164164 // }
165165 // }
166-
166+
167167 } // close read available
168- }
168+ }
0 commit comments