SparkFun will be closing early at 3:30 Friday 5/27 and remain closed Monday for Memorial Day (5/30). Orders placed after 2pm MT on Friday (5/27) will process and ship out on Tuesday (5/31).


Member Since: October 12, 2012

Country: United States

  • I agree with Signal7. The last_button_time variable is only touched when initialized, and when it is checked or set within the ISR function. A static variable with function scope is ideal. See https://en.wikipedia.org/wiki/Static_variable for a good description.

    The button_time variable could be a stack variable or static with function scope as well, just to minimize stack use during the ISR. Not a big deal with non-reentrant ISRs; either way is fine.

    Also, where are the pinMode() calls in setup()? Am I missing a reference somewhere that explains the default state of each pin and why it’s not necessary to set pin2 to INPUT or 13 to OUTPUT?

  • I think Scharkalvin was speaking of this kind of rotary encoder: https://www.sparkfun.com/products/9117

    It would take a lot of finger-gespinning to take up all the CPU with that…