Go Down

Topic: Bug in AnalogButtons library (Read 1 time) previous topic - next topic


Hello everyone, I think I have found a bug in AnalogButtons library, which I am using for a project since... 2 years ago!!!!  :smiley-eek-blue:

For anyone of you interested the bug is caused by:

Code: [Select]

void AnalogButtons::checkButtons()
  if (millis() + time > 70) // don't sample analog more than 70 ms

time is a class variable which is used to check if 70 ms (in this case) are over.
But of course we need the minus sign to check the current time (millis) against the previous saved time:
Code: [Select]

if (millis() - time > 70)

The IF in the original version is (almost) always true, this is way the library is actually working.

I cannon contact the author of the library, so I taught I could post this bug here.
Sorry if the forum is not the correct place...


Do you have a link to this (better the latest) analogButtons library?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


No.. the last version you can find is the buggy one... here..


I cannot contact the author. Maybe I should fill in a bug report in github, but I don't have an account yet..

In my previous message you can find all the correct code, which should work as expected. I tested it on my actual project, which has been working for 2 years already.

Go Up