TRANSFER SYSTEM RESET BUTTON

I’m making a transfer system for my cim class and the bonus requires a reset button to be added on. We have to create a reset button that will allow us to reset the program back to the beginning of the assembly line no matter what process it is currently working on. The pictures show my code so far. The EmergencyStopButton is not the same as the reset button by the way. Any help as to how to do this would be greatly appreciated!
image.jpg
image.jpg

SensorValue is an array.
i.e Change


SensorValue(EmergencyStopButton)

to


SensorValue[EmergencyStopButton]

The EmergencyStopButton works fine on my code. I’ve used it before.

In your while(true) loop, check the


EmergencyStopButton

sensor, right now you’re only checking it at the beginning of


task main()

Ya ROBOTC let’s both work, it clever like that.

My EmergencyStopButton is not the problem. I’m asking about how to create a reset code.

My transfer system looks basically like this: https://i.ytimg.com/vi/ZKCXP_SGXqo/maxresdefault.jpg

Put the code in main() in a different task (lets call it transfer() )and put some code in main() that checks for your reset button and if it is pressed stop transfer(), stop all motors, then start transfer() again.

Ok, thanks. I’ll try that. Do you happen to know what the code would look like to reverse my track. When the reset button is pushed I believe the track has to turn backwards but the quad encoder also needs to reset .

Actually my last post didn’t explain it very well. There will be an object on the transfer system. If for some reason it falls off I would need to push the reset button. I would then put the object back on the transfer system at the spot it fell off. What I need is a code that will reverse the track on the transfer system back to the beginning, which is before the sonar from any post motion on the transfer system that the object could have fallen off from.