This doesn't seem to do what you think it will..
Move blinkmodeon outisde the function. It will always be set to 1 when you enter the function (probably right after you set it to 0 and the while loop ends). No way to know without the rest of the coude though...