Skip to content

Commit 36b98c4

Browse files
committed
v1.7.1 rewrite attach & detach function set_servo_status
1 parent a9aeaf2 commit 36b98c4

10 files changed

Lines changed: 313 additions & 293 deletions

File tree

HISTORY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# uArm Arduino Library Release Note
22

3+
## [1.7.1] - 2016-06-28
4+
5+
### Fix
6+
- Set Current angle after attach servo
7+
- rewrite set_servo_status replace attach_servo detach_servo
8+
39
## [1.7.0] - 2016-06-24
410

511
### Fix

examples/Calibration/Calibration.ino

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ void manual_calibration_section()
180180
{
181181
int setLoop = 1;
182182

183-
uarm.detach_all_servos();
183+
uarm.set_servo_status(false, SERVO_ROT_NUM);
184+
uarm.set_servo_status(false, SERVO_LEFT_NUM);
185+
uarm.set_servo_status(false, SERVO_RIGHT_NUM);
186+
uarm.set_servo_status(false, SERVO_HAND_ROT_NUM);
184187

185188
Serial.println("Put uarm in calibration posture (servo 1 to 3: 45, 130, 20 degree respectively), then input 1");
186189
while (setLoop) {

examples/GetXYZ/GetXYZ.ino

Lines changed: 0 additions & 17 deletions
This file was deleted.

examples/GettingStarted/GettingStarted.ino

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,21 @@ void loop() {
8080
// Detach Servo
8181

8282
if (readSerial == 'd') {
83-
uarm.detach_all_servos();
83+
uarm.set_servo_status(false, SERVO_ROT_NUM);
84+
uarm.set_servo_status(false, SERVO_LEFT_NUM);
85+
uarm.set_servo_status(false, SERVO_RIGHT_NUM);
86+
uarm.set_servo_status(false, SERVO_HAND_ROT_NUM);
8487
}
88+
//---------------------------------- function a ------------------------------------
89+
// Detach Servo
90+
91+
if (readSerial == 'a') {
92+
uarm.set_servo_status(true, SERVO_ROT_NUM);
93+
uarm.set_servo_status(true, SERVO_LEFT_NUM);
94+
uarm.set_servo_status(true, SERVO_RIGHT_NUM);
95+
uarm.set_servo_status(true, SERVO_HAND_ROT_NUM);
96+
}
97+
8598
//---------------------------------- function o ------------------------------------
8699
// Pump on
87100
if (readSerial == 'o') {
@@ -97,7 +110,6 @@ void loop() {
97110
// function below is for print current x,y,z absolute location
98111

99112
if (readSerial == 'g') {
100-
uarm.detach_all_servos();
101113
uarm.get_current_xyz();
102114
Serial.print("The current location is ");
103115
Serial.print(uarm.get_current_x());

examples/UArmProtocol/UArmProtocol.ino

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#define UARM_FIRMATA_BUGFIX 2
2020

2121
#define UARM_FIRMWARE_MAJOR_VERSION 1
22-
#define UARM_FIRMWARE_MINOR_VERSION 6
23-
#define UARM_FIRMWARE_BUGFIX 2
22+
#define UARM_FIRMWARE_MINOR_VERSION 7
23+
#define UARM_FIRMWARE_BUGFIX 1
2424

2525
#define START_SYSEX 0xF0 // start a MIDI Sysex message
2626
#define END_SYSEX 0xF7 // end a MIDI Sysex message
@@ -37,7 +37,7 @@
3737
#define WRITE_ANALOG (0X17)
3838
#define READ_EEPROM (0X1A)
3939
#define WRITE_EEPROM (0X1B)
40-
#define DETACH_SERVO (0X1C)
40+
#define SERVO_STATUS (0X1C)
4141
#define PUMP_STATUS (0X1D)
4242
#define WRITE_STRETCH (0X1E)
4343
#define WRITE_LEFT_RIGHT_ANGLE (0X1F)
@@ -61,6 +61,7 @@ int sysexBytesRead;
6161
void setup()
6262
{
6363
Serial.begin(57600);
64+
uarm.init();
6465
}
6566

6667
void loop()
@@ -271,9 +272,12 @@ boolean handleSysex(byte command, byte argc, byte *argv)
271272
}
272273

273274
// CMD 1C Servo Attach or Detach
274-
if (uarmCommand == DETACH_SERVO)
275+
if (uarmCommand == SERVO_STATUS)
275276
{
276-
uarm.detach_all_servos();
277+
// uarm.detach_all_servos();
278+
byte servo_num = argv[1];
279+
boolean servo_status = argv[2] == 0 ? false : true;
280+
uarm.set_servo_status(servo_status, servo_num);
277281
return true;
278282
}
279283

examples/UArmTextControl2.0/UArmTextControl2.0.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ String runCommand(String cmnd){
167167
if(errorResponse.length() > 0) {return errorResponse; }
168168
float values[1];
169169
getCommandValues(cmnd, attachDetachParameters, 1, values);
170-
if(values[0] == 1) { uarm.g_servo_rot.attach(SERVO_ROT_PIN); }else if(values[0] == 2) { uarm.g_servo_left.attach(SERVO_LEFT_PIN); }else if(values[0] == 3) { uarm.g_servo_right.attach(SERVO_RIGHT_PIN); }else if(values[0] == 4) {uarm.g_servo_hand_rot.attach(SERVO_HAND_PIN); }else{ return F("[ERROR: Servo number does not exist]\n"); }
170+
if(values[0] == 1) { uarm.set_servo_status(true, SERVO_ROT_NUM); }else if(values[0] == 2) { uarm.set_servo_status(true, SERVO_LEFT_NUM); }else if(values[0] == 3) { uarm.set_servo_status(true, SERVO_RIGHT_NUM); }else if(values[0] == 4) { uarm.set_servo_status(true, SERVO_HAND_ROT_NUM); }else{ return F("[ERROR: Servo number does not exist]\n"); }
171171
return ok + cmnd + endB;
172172
}
173173

@@ -177,7 +177,7 @@ String runCommand(String cmnd){
177177
if(errorResponse.length() > 0) {return errorResponse; }
178178
float values[1];
179179
getCommandValues(cmnd, attachDetachParameters, 1, values);
180-
if(values[0] == 1) { uarm.g_servo_rot.detach(); }else if(values[0] == 2) {uarm.g_servo_left.detach(); }else if(values[0] == 3) {uarm.g_servo_right.detach(); }else if(values[0] == 4) {uarm.g_servo_hand_rot.detach(); }else{ return "[ERROR: Servo number " + String(values[0]) + " does not exist]\n"; }
180+
if(values[0] == 1) { uarm.set_servo_status(false, SERVO_ROT_NUM); }else if(values[0] == 2) {uarm.set_servo_status(false, SERVO_LEFT_NUM); }else if(values[0] == 3) {uarm.set_servo_status(false, SERVO_RIGHT_NUM); }else if(values[0] == 4) {uarm.set_servo_status(false, SERVO_HAND_ROT_NUM); }else{ return "[ERROR: Servo number " + String(values[0]) + " does not exist]\n"; }
181181
return ok + cmnd + endB;
182182
}
183183

0 commit comments

Comments
 (0)