Pages: [1]   Go Down
Author Topic: PWM Pins don't work  (Read 1001 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Mirek
Logged

Brighton, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Mark,

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

Jim
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
int ledPin = 13;
void setup() {
  pinMode(ledPin, OUTPUT);
}
void loop() {
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}
Logged

Brighton, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Jim


#include "Print.h"

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


// Run once, when the sketch starts.
void setup()
{
   Serial.begin(115200);
   Serial.println("Blink");
   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);
          delay(1);
          analogWrite(pin, 0);
          delay(1);
        }

   delay(100);

   count++;
}
Logged

Pages: [1]   Go Up
Jump to: