Go Down

Topic: PWM Pins don't work (Read 1 time) previous topic - next topic

Hi All,

I am new to Arduino as well as I'm new to electronics, but I was always interested.
I have bought Arduino Due and I'm trying some simple projects, but I found a problem. PWM pins 2-7 do not work. I tried to make them blink led but it didn't work. Is there anything special about those pins that need to be setup or should it work with no modification?
All other PWM pins work OK. Does that mean my pins are broken?

Thank you for any helpful comments.



Hi Mark,

Could you show us the siimplest sketch that doesn't work please?


I tried this on all other PWM pins and it worked. Pin here is set to 13 but I changed that to all PWM pins.

Code: [Select]
int ledPin = 13;
void setup() {
 pinMode(ledPin, OUTPUT);
void loop() {
 digitalWrite(ledPin, HIGH);
 digitalWrite(ledPin, LOW);


Hi Mirek,

Sorry, misread your name...

With the test sketch below, I get the expected outputs on a scope on pins 3 to 13 continuously, but strangely intermittent activity on pin 2 - I'll investigate further when I have time.


#include "Print.h"

int count = 1;
int ledPin =  13;    // LED connected to digital pin 13

// Run once, when the sketch starts.
void setup()
   count = 0;

   // initialize the digital pin as an output:
   pinMode(ledPin, OUTPUT);    

void loop()                    
       // Write to PWM pins.
       for (int pin = 2; pin <= 13; pin++)
         analogWrite(pin, 255);
         analogWrite(pin, 0);



Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131