Hi,
I don't really follow your coding but you have a main loop which constantly (I mean thousands of times per second) keeps setting the dutycycle to some value. When the interrupt fires, decide which way to turn (if any) and set the dutycycle, don't change it the main loop. BTW, does 10Hz really work? Also, in your previous code I got the impression that the sensors were analog (you used ADCIN to read them) but now they are digital?
/Henrik.
EDIT: One more thing, you don't seem to reload the timer value in the ISR.
Since the timer is freerunning and generating an interrupt on overflow, with a prescaler of 8 and a 4MHz x-tal the interrupt frequency of 4000000/4/8/65536=1.9Hz, I think you need to run faster than that.
Bookmarks