Timeline for Can I use the analog pins on the Arduino for my project as digital?
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 2 at 21:11 | comment | added | Ken Shirriff | No, digitalRead() on the analog pins does not round the analog value. Thus, to answer @Johncl's question, digitalRead() is not slower. On the Uno, it reads the value digitally using digital I/O port C, which shares pins with the analog (ADC) pins. This is completely different from analogRead()'s analog conversion process. You can verify this from the digitalRead() source code which simply tests the bit: github.com/arduino/ArduinoCore-avr/blob/… | |
Mar 18, 2022 at 22:14 | comment | added | Orion Lawlor | One exception: the Arduino Nano, Pro Mini, and Mini’s extra A6 and A7 pins can only be used as analog inputs, not digital inputs or outputs. This is a hardware limitation specific to those pins, not found on other models. | |
S Nov 13, 2019 at 12:34 | history | suggested | dotancohen | CC BY-SA 4.0 |
Remove obviously errant link
|
Nov 13, 2019 at 12:09 | comment | added | dotancohen |
This is very concise and informative, thank you, however I believe that there is one small error. According to the fine docs: the Arduino (ATmega) will report HIGH if: a voltage greater than 3.0V is present at the pin (5V boards) which contradicts the statement in this post If analogRead(A0) is greater than or equal to 512, digitalRead(A0) will be 1, else 0 .
|
|
Nov 13, 2019 at 11:59 | review | Suggested edits | |||
S Nov 13, 2019 at 12:34 | |||||
Apr 13, 2017 at 12:32 | history | edited | CommunityBot |
replaced http://electronics.stackexchange.com/ with https://electronics.stackexchange.com/
|
|
Nov 2, 2015 at 18:28 | comment | added | Johncl | Are digitalRead() and digitalWrite() on analog pins slower? If digitalRead() rounds the value I can imagine it being way slower than digitalRead() on a digital pin? | |
Apr 26, 2013 at 5:38 | history | edited | Manishearth | CC BY-SA 3.0 |
added 98 characters in body
|
Apr 10, 2013 at 17:53 | comment | added | baldengineer | Much better! :) | |
Apr 10, 2013 at 15:42 | comment | added | Manishearth | @JamesC4S: Good point, edited. Thanks :) | |
Apr 10, 2013 at 14:23 | comment | added | baldengineer | AnalogWrite() does not output voltages between 0 to 5 (except on the Due)! AnalogWrite() only changes the pulse width modulation of the signal. The output voltage is still 5volts (or whatever VCC is). The pins marked "analog" will only output 0V or 5V. They are not variable and are note | |
Apr 10, 2013 at 8:31 | history | answered | Manishearth | CC BY-SA 3.0 |