SparkFun will be closed Nov 26th and 27th for the Thanksgiving holiday. Orders placed after 2:00pm MT on the 25th will ship out Monday the 30th.


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…