2222
2323// headers should must include these four headers
2424
25- #include < EEPROM.h>
26- #include < Wire.h>
2725#include " uarm_library.h"
28- #include < Servo.h>
2926
3027// define a uArm
3128// uArmLibrary uArm;
@@ -51,7 +48,7 @@ void loop() {
5148 // x = 13, y = -13, z = 3
5249
5350 if (readSerial == ' 1' ) {
54- uarm.moveTo (13 ,-13 ,3 );
51+ uarm.move_to (13 ,-13 ,3 );
5552 delay (1000 );
5653 }
5754
@@ -60,7 +57,7 @@ void loop() {
6057 // x = -13, y = -13, z = 3
6158
6259 if (readSerial == ' 2' ) {
63- uarm.moveTo (-13 ,-13 ,3 );
60+ uarm.move_to (-13 ,-13 ,3 );
6461 delay (1000 );
6562 }
6663
@@ -69,7 +66,7 @@ void loop() {
6966 // (dot) dx = 4, dy = -3, dz = 2 in 5 seconds
7067
7168 if (readSerial == ' 3' ) {
72- uarm.moveTo ( 1 , 1 , 1 ,RELATIVE ,2 );
69+ uarm.move_to ( 5 , 0 , 0 ,RELATIVE ,2 );
7370 delay (1000 );
7471 }
7572
@@ -78,40 +75,12 @@ void loop() {
7875 // (dot) dx = -4, dy = 3, dz = -2 in 5 seconds
7976
8077 if (readSerial == ' 4' ) {
81- uarm.moveTo (-4 ,3 ,-2 ,RELATIVE ,5 );
78+ uarm.move_to (-4 ,3 ,-2 ,RELATIVE ,5 );
8279 delay (1000 );
8380 }
8481
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- // }
102-
103- // ---------------------------------- function 7 ------------------------------------
104- // function below is atach all servos
105-
106- // if (readSerial == 'a') {
107- // uarm.attachAll();
108- // }
109-
110- // ---------------------------------- function 8 ------------------------------------
111- // function below is detach all servos
112-
11382 if (readSerial == ' d' ) {
114- uarm.detachAll ();
83+ uarm.detach_all_servos ();
11584 }
11685
11786 // ---------------------------------- function 9 ------------------------------------
@@ -125,33 +94,35 @@ void loop() {
12594 // function below is for print current x,y,z absolute location
12695
12796 if (readSerial == ' g' ) {
97+ uarm.detach_all_servos ();
98+ uarm.get_current_xyz ();
12899 Serial.print (" The current location is " );
129- Serial.print (uarm.getCalX ());
100+ Serial.print (uarm.get_current_x ());
130101 Serial.print (" , " );
131- Serial.print (uarm.getCalY ());
102+ Serial.print (uarm.get_current_y ());
132103 Serial.print (" , " );
133- Serial.print (uarm.getCalZ ());
104+ Serial.print (uarm.get_current_z ());
134105 Serial.println ();
135106 delay (1000 );
136107 }
137108
138109 if (readSerial == ' k' ) {
139110 Serial.print (" SERVO_ROT_NUM offset:" );
140- Serial.println (uarm.readServoOffset (SERVO_ROT_NUM ));
111+ Serial.println (uarm.read_servo_offset (SERVO_ROT_NUM ));
141112 Serial.print (" SERVO_LEFT_NUM offset:" );
142- Serial.println (uarm.readServoOffset (SERVO_LEFT_NUM ));
113+ Serial.println (uarm.read_servo_offset (SERVO_LEFT_NUM ));
143114 Serial.print (" SERVO_RIGHT_NUM offset:" );
144- Serial.println (uarm.readServoOffset (SERVO_RIGHT_NUM ));
115+ Serial.println (uarm.read_servo_offset (SERVO_RIGHT_NUM ));
145116 Serial.print (" SERVO_HAND_ROT_NUM offset:" );
146- Serial.println (uarm.readServoOffset (SERVO_HAND_ROT_NUM ));
117+ Serial.println (uarm.read_servo_offset (SERVO_HAND_ROT_NUM ));
147118 }
148119
149120 if (readSerial == ' o' ) {
150- uarm.pumpOn ();
121+ uarm.pump_on ();
151122 }
152123
153124 if (readSerial == ' f' ) {
154- uarm.pumpOff ();
125+ uarm.pump_off ();
155126 }
156127
157128 // ---------------------------------- function 11 ------------------------------------
0 commit comments