Can someone explain me why in this sketch, the variable S1_start is never updated at line 201, so as soon as the if is OK at line 197, it automatically enter the second if at line 206 since the S1_start is not reset so it sees like it is already over 10 seconds?
Thanx a lot!
RELACHEUR.ino (4.49 KB)
Yes, it was a test that i haven't removed before posting! My bad, in the original code line 201 was only: S1_start = millis();
And it was not working either.
Robin2
August 23, 2015, 8:08am
5
Assuming you correct the problem of the unnecessary unsigned long ...
How do you know that S1_start is not being updated ?
How do you know that the IF in which it is contained is ever TRUE ?
Add som SIMPLE print statements so you can see what is happening.
I note that you are assigning the value of millis() to an int called switched. That is likely to cause a headache at some time.
Mixing delay() and millis() is rarely profitable. Use millis() to manage all your timing as illustrated in several things at a time .
...R
PS . please get rid of all the irrelevant junk in your code before you post the next version.