interrupts This time

Basrad

Member
I've had a read though old posts regarding interrupts, but I cant seem to make one work properly..

I'll attach my code for a viewing..

When button is pressed the code starts too loop... (Great)

Now I need a Stop/Home button.. (which I thought was easy)

And a emergancy stop button.. (FULL STOP) Which I think is a job for an interupt? Just cant get it to work.

If you have time please look at my code, any code suggestions welcome.
 

Attachments

hippy

Ex-Staff (retired)
You need to define what you want to happen when you press stop, decide where that will take you to, then work out how to detect that and go where you want.

You have two options; polling or interrupt. For polling you'll need loops instead of long pauses to have responsiveness. For interrupts you'll need to have a flag and tests in the interrupted loops to check if an interrupt has occurred.

The best way to get that working is to simplify the code, for example cycle only the gripper, then add your stop button or interrupt handling. Once working you can apply that to the full program.
 
Top