0
\$\begingroup\$

I am using the following simple program to blink 5 pairs of LEDs using my Digispark ATTiny85. The circuit is very simple, not even have the necessary resistors to limit current. I was just trying for the first time with Digispark ATTiny85 board. But, when I run it by plugging in 5V power supply to the Micro USB Port on the board, I see the P5 LEDs glow dim and the P4 LEDs glow bright continuously. No blinking effect. Neither does the other LEDs glow at all. Just these 2 pairs glowing continuously. Am I doing something really wrong? I know the HIGH on P5 is 3V and current limiting resistors are missing. But that should not prevent the microcontroller to blink the remaining LEDs.

void setup() {
    pinMode(0,OUTPUT);
    pinMode(1,OUTPUT);
    pinMode(2,OUTPUT);
    pinMode(4,OUTPUT);
    pinMode(5,OUTPUT);
    digitalWrite(0,LOW);
    digitalWrite(1,LOW);
    digitalWrite(2,LOW);
    digitalWrite(4,LOW);
    digitalWrite(5,LOW);
}

void loop() {
    digitalWrite(0,HIGH);
    delay(500);
    digitalWrite(0,LOW);
    digitalWrite(1,HIGH);
    delay(500);
    digitalWrite(1,LOW);
    digitalWrite(2,HIGH);
    delay(500);
    digitalWrite(2,LOW);
    digitalWrite(4,HIGH);
    delay(500);
    digitalWrite(4,LOW);
    digitalWrite(5,HIGH);
    delay(500);
    digitalWrite(5,LOW);
}

And following is the schematic.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • 2
    \$\begingroup\$ > "But that should not prevent the microcontroller to blink the remaining LEDs." Are you absolutely sure about that? What if the current from P4 to GND is large enough to pull the VCC below the operating voltage of the Attiny, or something to that effect? \$\endgroup\$ – Dampmaskin Dec 15 '16 at 11:05
  • \$\begingroup\$ But how would P4 get HIGH before P0-P3? I never see the first 3 LEDs blink. See my program above. \$\endgroup\$ – sribasu Dec 15 '16 at 16:22
  • 1
    \$\begingroup\$ Add the current limiting resistors for the LEDs. As you say in your second sentence, they are necessary. \$\endgroup\$ – Peter Bennett Dec 15 '16 at 17:14
  • \$\begingroup\$ What colour or forward voltage are your LEDs? 3 volts may not be enough to light white LEDs. \$\endgroup\$ – Peter Bennett Dec 15 '16 at 17:16
  • \$\begingroup\$ You know what, I just stopped using the 3V pin i.e. P5 and now using P0 through P4. It works fine now. What could be the reason? I really didn't add any resistor to fix it. Is the P5 pin connected to LEDs without a current limiting resistor causing the problem? \$\endgroup\$ – sribasu Dec 15 '16 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.