I've read there https://www.raspberrypi.org/documentation/usage/gpio/ that we have 4 pins which can be used as analog, but other people say that we use only 2, so what's the correct answer?
Asked
Active
Viewed 2,192 times
2
-
1analog what? ... input or output? – jsotola Nov 23 '19 at 08:22
-
1Unlike Arduino, Rpi does not have any ADC (Analog to Digital) pins. You need to use external ADC chips/modules, eg MCP3008. – tlfong01 Nov 23 '19 at 08:40
-
1The simple answer is "zero" without additional hardware. – Dougie Nov 23 '19 at 14:47
-
The simplest answer is "Zero". – tlfong01 Nov 24 '19 at 00:10
1 Answers
7
The Raspberry Pi has NO analogue GPIO. All the GPIO are digital only.
Perhaps you are being confused by some Arduino terminology. If a digital GPIO is used to generate PWM they often incorrectly refer to that GPIO as an analogue output.
If that's the case you are probably referring to the Pi's hardware PWM (output) capability. The Pi's with the 40 pin header (and the compute modules) can provide hardware PWM on GPIO 12, 13, 18, 19. However there are only two PWM channels so GPIO 12/18 will have identical outputs as will GPIO 13/19.
joan
- 71,014
- 5
- 73
- 106
-
1Note that PWM output is strictly speaking not an analog output, it's just a quickly switching digital output that may for some applications look like an analog output (i.e. when controlling the brightness of an LED). – PMF Nov 23 '19 at 13:37