I'm trying to make a homebot that can move with two bipolar steppers and detect if a obstacle is near with a SRF05 sonar.
My question is : Since Step() is a function that cannot be interrupted, how can I be sure that I still can detect an obstacle in front of me at all time ?
Shall I use interruptions ? Is there any tutorial then ?
If I were going straight forward this would be ok yeah. But if i've got a preprogrammed sequence I want my bot to follow with his two steppers, it may be no very nice to have lots of ligns which calls to the sensor function. Don't you think so ?
I want my bot to do something like -- Forward (200 steps) -- Turn 90° left -- Forward 200 steps -- Turn 90° right .... etc ... and that if i put my hands in front of the sensor, the bot stops.
So, I can make it go forward and turn. But I don't know how to combine that with the fact that it must detect and obstacle and stop whatever it is.
I don't know if i'm clear enough ... hem ... so I've read that steps() can't be stopped. So, is it possible to do what i wish to do ?