Arduino Millis and Indexing Code

  • I’ll expand on this a bit.

  • As I have said there is class code in our sketch which is responsible for checking to see if a physical switch is sitting at the same state as the last time it was checked.
    .
    The name given to this code is object.validChange() where object is the name we give in the class object definition, in this case, mySwitch, hence mySwitch.validChange().
    - If input pin is at the same state as the last time checked, the class code returns the number 2, NOchange (2) .
    - The class code returns the number 0, NOTvalidated (0), if the state on the input pin has changed but the class code needs a bit more time to make sure this change isn’t due to electrical noise or maybe the switch contacts are bouncing.
    - And lastly, the class code returns the number 1, VALIDATED (1), when the input change has been stable for at least 50ms without any contact bouncing.




  • Yes, please give us the error message.
    I will do the same here to see if an error comes up.

  • Most often, it’s probably a spelling mistake :wink: