ARDUINO UNO: Digital Pins 4-8 as Outputs

I'm a newbie. I have read that ARDUINO UNO has data pins D0-D13 and A0-A5 can be configured as digital output pins.

But, let's only focus on what are in my book marked as "Digital Connections", that is D4-D8.

Only D6 is marked as a PWM (I presume as an INPUT as well as an OUTPUT pin). Does that mean then that pins D4,D5,D7, & D8 can only output either 0V or 5V. Thanks.

All pins can be digital I/O: A0-A5, 0-13. All with 5V. Those marked with ~ are PWM: 3,5,6,,9,10,11.

Uno. see Documentation tab

Budvar10:
All pins can be digital I/O: A0-A5, 0-13. All with 5V. Those marked with ~ are PWM: 3,5,6,,9,10,11.

So, as regarding that limited set I've described, (D4 to D8) only D6 could output say PWM audio? The others not?

You know, when someone asks a question, that might have a simple answer, it does not mean that they are either intellectually challenged, or lazy. That ought to be obvious to everybody. Because oftentimes the real issue isn't intellectual inability or laziness. It's confidence. And when that is at play, the person simply needs confirmation, such as "Yes, that's correct". Such is the case here. It's always a sign of a forum's negative culture, when people cannot help, for want of non-judgement.

1 Like

richard2865:
the person simply needs confirmation, such as "Yes, that's correct". Such is the case here.

it is not correct.

some pins have specialized functions:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.
External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.
LED: 13. There is a built-in LED driven by digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.
TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library.

The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts

richard2865:
So, as regarding that limited set I've described, (D4 to D8) only D6 could output say PWM audio? The others not?

What do you mean by PWM Audio? Do you mean like, tones from a squarewave? You can get that on any pin, not just a PWM pin, see https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/ - tone() uses an interrupt to switch the pins in an ISR, rather than generating them direct from the output compare unit (it might be smart enough to use the output compare if it's on pins 3 or 11, which are the output compare pins for timer2 which is what '328p-based boards use for tone). If you mean something else, please explain?

@juraj - What is not correct? That block of text you quoted looks correct to me.

Does that mean then that pins D4,D5,D7, & D8 can only output either 0V or 5V.
:
[perhaps] the person simply needs confirmation, such as "Yes, that's correct".

In this case, the question is vague enough to beg additional clarification (not that that is what you got...)
In some sense: "Yes, that's correct." Pins 4,5,7,8 are only "serviced" by "digitalWrite()" and "digitalRead()"
But you can do those "really fast" and achieve other effects - software serial, software pwm, servo driving, bit-banged on-wire communications, one-bit audio... In theory, any pin can do these things.
The PWM pins can additionally use analogWrite(), which supports hardware PWM, at about 500Hz. That's not fast enough to do audio, though.
The analog pins support analogRead(), which can read a voltage in between 0 and 5V in a more-or-less continuous way (200 means about 1V, 400 means about 2V, etc...)

Hi,
I think the OP hasn't quite got the idea of how the PWM works.

PWM, Pulse Width Modulation, is a pulse train that is generated where using a basic command:

analogWrite(pinumber, value);

"value" causes the pulse train to be output at various Duty cycle, in the standard Arduino world, 0 to 255 is the range of duty, translating to 0 to 100%.
The frequency of the PWM does not change, and depending on which PWM pin you use, the actual frequency will be different.
There are libraries that allow you to put PWM on other pins, with different frequencies, but I haven't tried them.

Tom.... :slight_smile: