Go Down

Topic: analog buttons as digital? (Read 2 times) previous topic - next topic

McKinnley

Hey!

Thanks for you help. I got S1 to work with using >= 100 but not the other analog buttons.


Quote
Based on the schematic, S1 will return a value of 0 while S2 will return a value of 700mV.  This means analog values between 0 and ~140 are probably S1.  


How did you determine from the schematic that S1 will return a value of 0 and S7 700mV. Then how did you determine from there that the analog values would read b/t 0 and 140?

Thank you again.
McKinnley

AWOL

Quote
Then how did you determine from there that the analog values would read b/t 0 and 140

Well, if 5V returns 1023, then 0.7V will return (0.7 / 5) * 1023 = 143.22
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

McKinnley

Oh okay I understand!

So then the range 0-.7 volts that goes across S1 comes from what. How do I get what the voltage going across the other buttons would be?

Grumpy_Mike

Well you could calculate it but it is simpler just to read the value and print it out so you can see the voltage given by not just the individual buttons but all the combination of buttons.

James C4S

The resistors attached to each button creates a voltage divider.

As mike suggests, the easiest thing to do is write a sketch that prints out of the value of the analogRead.  Then go through and press each button.  Just remember that you are reading an analog input.  So if one of the buttons returns 143 today it might return 141 or 144 tomorrow.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Go Up