Can i use analog pins(A0,-----A5) of Atmega328 for Toggle switches?
I moved your topic to an appropriate forum category @deremi.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
Do you mean you want to detect the state of a switch connected to an analog pin?
for counting the number of time the switch is press and display the result on lcd
Why not simply use them as digital pins?
Yes, you can use the analogue in pins A0 to A5
You need to detect when the button becomes pressed rather than when it is pressed
See the StateChangeDetection example in the IDE
Yes but just remember since you mention a LCD that the SCL and SDA pins are also A4 and A5 so if using the SCL and SDA pins you don't have A4 and A5 available.
Ron
We don't actually know whether the LCD is an I2C device but if it is then its use of the analogue pins needs to be taken into account
Yes, it was a just in case post as to A4 and A5.
Ron
I’m curious whether you know what a toggle switch is - as opposed to other types…. momentary, press button, etc.
Yes a momentary press button, that is what it is.
Yes you can
I would like to clarify what you are trying to do
What will happen when you press the button ?
Will something different happen when you press the button again ?
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.