Home Page Forums Tinylab Read rotary encoder state using an interrupt

This topic contains 0 replies, has 1 voice, and was last updated by  AndreN 2 years, 2 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #215

    AndreN
    Member

    “S F” on the TinyLab Indiegogo page pointed out that the rotary encoder test in the “tinylab_test_code” project that’s installed on the TinyLab by default doesn’t work very well. Turning the encoder seems to do almost nothing. The problem is the rotary encoder state is being read by polling, and the loop() function is very slow. I didn’t measure it but it may only loop 10 times per second. That’s not nearly enough to read the encoder if it’s turned quickly. So I wrote a quick sample that reads the encoder on a 500hz timer. Then in the loop() we just see if the encoder value changed and display it if it did. You can find my sample project at:

    https://github.com/AndreNeedham/TinyLab/tree/master/EncoderInterrupt

    You’ll also need the TimerOne library which you can find at https://github.com/PaulStoffregen/TimerOne

     

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.