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

asked May 29, 2018 at 21:29
3
  • 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 Commented May 29, 2018 at 21:32
  • A1 and A2 could be also digital, but A6 and A7 as I understand - no (see attached pinout schema) Commented May 29, 2018 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"? Commented May 30, 2018 at 1:07

1 Answer 1

3

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).

answered May 29, 2018 at 21:36
3
  • That is what I thought... So is it possible to make OneButton with analog pins? Commented May 29, 2018 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. Commented May 29, 2018 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. Commented May 30, 2018 at 17:48

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.