I have a robot and lever mechanism. The arm is at 1 end of lever mech and the load cell with Arduino at the other. The robot will move the lever and when a force defined in the Arduino is reached, the output is turned on. the robot needs to keep moving and stop when the output is turned on. I had a program with 2 if statements. 1 if statement was if DI was true and the other was if DI was low. when the the DI goes high i want the robot to stop regardless of where waypoint is.
You can use a "if continuously check" statement followed by a stopj() to decelerate the robot and stop it.
I used the check expression continuously and now something odd is happening. it doesn't reach the start waypoint after the 1st cycle
Can you paste up a screenshot of your program so we can see if there is an error somewhere? Are you sure the DI is going low?
I think what going on is the DI0 starts as low state so the robot goes to the loaded waypoint and in doing that turns the DI0 to a high state and so robot moves to Unloaded but going to unloaded changes DI0 from high to low and therefore not reaching unloaded again and doing a loop with the inputs changing.
Statements in the BeforeStart section are executed only at the first execution of the program. Those instructions are not executed on the second loop.I think you can only use one if statement. Laso stopj() is necessary if you want to avoid protective stop when the robot suddently change direction from one waypoint to the other.
What I done instead was use the direction command which allowed me to do a z- move on the robot until DI0 goes true. simplifies the entire program and does exactly what I need.
I have a robot and lever mechanism. The arm is at 1 end of lever mech and the load cell with Arduino at the other. The robot will move the lever and when a force defined in the Arduino is reached, the output is turned on. the robot needs to keep moving and stop when the output is turned on. I had a program with 2 if statements. 1 if statement was if DI was true and the other was if DI was low. when the the DI goes high i want the robot to stop regardless of where waypoint is.