uArm won't do all of code

I have created a small program that moves the arm but the robot will not do all of the program. It will calibrate then just wait, if i open a console sometimes the robot will go back thru calibration. Below is code.

#include <EEPROM.h>
#include <Wire.h>
#include <Servo.h>
#include <Servo.h>
#include “uarm_calibration.h”
#include “uarm_library.h” //name of uArm Library

const int value = 0; // value is the data recevied

void setup() {

Wire.begin(); // join i2c bus (address optional for master)
calib.calibrations();
delay(5000);
}

void loop() {

uarm.moveTo(80, -20, 20, 45, 4); //move uArm end effect to coordinate x=0, y=-20, z=20 from current location
delay(4000);
uarm.moveTo(-80, -40, 20, 45, 4); //move uArm end effect to coordinate x=0, y=-20, z=20 from current location
delay(4000);
// pulse one
uarm.moveTo(80, -20, 20, 45, 4); //move uArm end effect to coordinate x=0, y=-20, z=20 from current location
delay(4000);
uarm.moveTo(-80, -40, 20, 45, 4); //move uArm end effect to coordinate x=0, y=-20, z=20 from current location
delay(4000);
// pulse two
uarm.moveTo(80, -20, 20, 45, 4); //move uArm end effect to coordinate x=0, y=-20, z=20 from current location
delay(4000);
uarm.moveTo(-80, -40, 20, 45, 4); //move uArm end effect to coordinate x=0, y=-20, z=20 from current location
delay(4000);
// pulse three
uarm.moveTo(80, -20, 20, 45, 4); //move uArm end effect to coordinate x=0, y=-20, z=20 from current location
delay(4000);
uarm.moveTo(-80, -40, 20, 45, 4); //move uArm end effect to coordinate x=0, y=-20, z=20 from current location
delay(4000);
// pulse four

// now want a delay of 696 seconds
delay(695000);

// now do it all over again

}

Once you calibrate your uArm, the results are stored in the uArm EPROM so you do not need to run the calibrations each time in your program.

Remove the include “uarm_calibration.h” and the calib.calibrations(); to avoid doing calibration on each reset (which happens on startup and when you open a console.)

ALSO the values you are sending, e.g., (80, -20, 20, 45, 4) are not valid positions for the uArm. If you want to move relative by (0, -20, 20), the code would be (for a 4-second move):

uarm.moveTo(0, -20, 20, 1, 4);

The fourth parameter relative is either 1 for relative or 0 for absolute.

Still, however, those numbers may be too large, depending on where you start. Take a look at the range diagram on this page http://developer.ufactory.cc/hardware/ and maybe experiment with smaller numbers.

Good luck!

Thanks for the help DCorboy

couple of more questions if you don’t mind.

if I run the eeprom code that erases the eeprom so i would have to re-calibrate. is that a correct statement?

When i first started up the arm and run the Uarm Client program the arm moved according to the location of button. What program was that if i want to test other locations? Which brings me to another question, how does the numbers shown in the clieant program relate to the uarm.move command?

thanks

Yes, if you run the code that clears the EEPROM, you must recalibrate before using the arm or servo damage could result.

By Uarm Client program, do you mean the Calibration.ino sketch? In the code, you can see that if you press “1”, the arm will move to (13,-13,6), which is a valid position (13cm to the right of center, 13cm forward from the center and 6cm up).

You can make a copy of that sketch, remove all the calibration stuff, and try out your own arm positions. Do not try to reach positions outside where the arm can reach. (For example, never use a positive Y number, which would be behind the arm.)

A good way to see the X,Y,Z values of a position that the arm can reach is to use the Example sketch GetXYZ that is part of the Arduino firmware download. With that sketch, you can position the arm anywhere and see valid X,Y,Z positions that you can use to determine your own moves.

I hope that helps!