Blink Without delay help again.

ash901226:
tuxduino i notice that in reply #8 u said that my code change the global variable and then discarded. although i dont really follow what you mean, i wish to change my code to something better, so i hope you would help me tuxduino. How can i make it to become a better code, thus later on i could make it as a function and a class so that i could use it again for other led or what not.

Just remove the return statements in turnon and turnoff, and declare them void.

Then, as I said before, change the names of ptimer and ntimer to something that matches their role in the code.

Your code looks a bit convoluted, though (at least to me), I'd start over by copying the blink without delay example (you find it in the IDE somewhere under File => examples)

BTW, do you know the difference between global and local variables, and do you know what "return value" means, when talking about functions ?