|
Re: IR reflective (tape) sensor code problems
where are you declaring "counter" and "endprogram"? if they are outside a function, you probably need to initialize them somewhere else (i.e. don't put the =0 part in, instead assign them the value of 0 in User_Initialization or somewhere there).
if they are in the function, add "static" in front of "int", so that it reads "static int counter" and "static short endprogram" - you don't want the values reset every time the function is called.
it does seem that the counter is working at least somewhat decently, though, as it is waiting for 15 seconds... could you post the code that comes after the IR part?
|