Expanding Machine State Pages

yes - use capacitors to debounce your switches in hardware.

@dparson , I thought array indexes started at 0?
Thanks for the catch with the index! That index rolling to 4 would have caused issues for sure.
I've been packaging code into functions as I go along, I have been focusing on getting things working at the moment though and will be reviewing the code once it is working.
I am almost certain I have issues with how I am writing things to EEPROM, I wrote the EEPROM code quickly and I think I need to carefully review what I am doing.

@johnerrington , I've looked into using capacitors, but that would add extra physical complexity, and a big issue I have is the effort to push the buttons causes them to be depressed for a long time, hence the long debounce time.

They do. But the declaration specifies the number of elements. An array that includes zero, has one extra value besides the ordinal numbers 1,2,3... so the last element is indexed by the number of elements minus one.

What does this mean, effort? Are the buttons special in some way, as in requiring a huge force to move them? Or..?

@anon57585045 , thanks for clarifying the array index question

What does this mean, effort?

@anon57585045 , they aren't special, they're just normal momentary contact switches, but if I have a debounce time much shorter then when the user pushes a button it is really easy to skip numbers, i.e. the numbers will appear to jump ahead or back.

That just means your debounce code is broken. It has nothing to do with the debounce interval you choose, in that case.

More proof that you need to treat button handling differently.

Ok all problems solved! The weird behavior with the timeon/off variables was all due to improperly initialized arrays. Everything works as it should at the moment.

Thanks everybody for the help!! Really appreciated all of it!

ggs, high-fives all around

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.