1

I noticed that OneButton library does not work with pins A6 and A7 (with A1 and A2 it works good) on my Arduino Nano. Is it because A6 and A7 are Analog only? There is possibility to make them work properly?

sketch example is here https://github.com/mathertel/OneButton/blob/master/examples/TwoButtons/TwoButtons.ino

enter image description here

  • Is it because A6 and A7 are Analog? ... why would you would ask that? A1 and A2 are also analog pins. .... please post the sketch that fails – jsotola May 29 '18 at 21:32
  • A1 and A2 could be also digital, but A6 and A7 as I understand - no (see attached pinout schema) – Филипп Цветков May 29 '18 at 21:36
  • that is not what you said in your question .... when it comes to technical questions, you have to be precise .... change your statement to Is it because A6 and A7 are "analog only"? – jsotola May 30 '18 at 1:07
2

Pins A6 and A7 are analog only pins. They have no digital functionality at all.

enter image description here

You can see that pins 19 and 22 only have ADCn on them - no Pxn for digital operation (ignore the colour scheme of those pins - that's an error in the datasheet).

  • That is what I thought... So is it possible to make OneButton with analog pins? – Филипп Цветков May 29 '18 at 21:40
  • 1
    That is correct. You would have to adapt it to use analogRead() on those pins and compare the incoming values to threshold values for HIGH and LOW. Could be done, but clunky. – Majenko May 29 '18 at 21:41
  • In the library, in the function tick, there is the digitalRead call. You could change that line to test if pin a6 or a7 is used and then use code with analogRead. Perhaps the author of the library is willing to add that. You could make an issue and ask for a feature request. – Jot May 30 '18 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.