Home› Programming
Discussion
Back to discussions page
Ruddock984
Posts: 16 Apprentice
Stopping a way point by means of digital input |
35 views
|
Answered | |
/ Most recent by Ruddock984
in Programming
|
6 comments |
in Programming
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.
Best Answer
-
Ruddock984 Posts: 16 Apprentice
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.
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.