Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

(new to arduino) what is wrong with the code below, I can see port 9 and 10 blinks at same time, later port 11 blinks.

when I try with port 3, 5, 6 it works fine. I have problem only with 9,10,11 ports

const int col[3] = {9,10,11};

void setup() {
  for (int thisPin = 0; thisPin < 3; thisPin++) {
    pinMode(col[thisPin], OUTPUT); 
  }
}

void loop() {
  refreshScreen();
}  

void refreshScreen() {
  for (int index = 0; index < 3; index++) {
    digitalWrite(col[index], HIGH);
    delay(300);
    digitalWrite(col[index], LOW);
  }
}

Does my arduino has defect or is it PWM ports behave like this!!! ?

share|improve this question
1  
I have copied and tested your code on my own Uno, and had no issues, the code acts as expected. Is it possible that your wiring to the LEDs is incorrect? –  craigkoiter Jul 2 at 13:42
    
Yes craigkoiter wiring to the LEDs are correct. So PMW pins should behave like normal pins. –  naren Jul 2 at 16:00
1  
Same here: '328p on a breadboard, it works on either set of ports. Could any of your connections be intermittent? –  JRobert Jul 2 at 16:01
1  
PWM pins are normal pins until you use them as PWM pins. –  Ignacio Vazquez-Abrams Jul 2 at 16:40
    
Thanks a lot guys, I bought a new arduino and my code works fine. problem was with hardware. –  naren Jul 7 at 11:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.