I am using Sabertooth 2x25 to drive two motors ( using servo ) for the robot and using six Sharp GP2D15 IR sensor for obstacles avoidance. This IR sensor gives 1 when sense something and a zero when nothing is sensed. So to use the arduino interrupt, I actually used a NOT gate 7404 to invert the signal.
But when interrupt occurs, the wheels didn't change direction as how I programmed it to do.
I had tried it using LED to check whether interrupt occurs or not, as well as using oscilloscope to check out the waveform and sort. Everything working fine, but once I change the code to control the motor, the interrupt does occur but motor didn't change direction.
As I mentioned, I used oscilloscope to check the servo pulse generated, as interrupts occurs, no servo pulse is generated.
Any kind soul can help me with this problem? I had attached my program below.
ir_test_1.ino (1.13 KB)