ATtiny45 & 85 Pin Output Question

Hi. I have a sketch that I downloaded to an ATtiny45 to trigger a sequence of 5 LEDs, but for some reason, the output of pin 2 (assigned to LED #3) from the tiny is dim. In fact, it's only 2.5V, and it should be 5V. However, when I assign pin 3 to LEDs #3 and #4, the result is perfect, and bright. Can someone explain why this happens? Thanks so much! Here is the sketch:

int Led1 = 0;
int Led2 = 1;
int Led3 = 2;
int Led4 = 3;
int Led5 = 4;

void  setup(){
pinMode (Led1, 5);
pinMode (Led5, 6);
pinMode (Led2, 7);
pinMode (Led3, 3);
pinMode (Led4, 3);
}

void loop(){
digitalWrite (Led1, HIGH);
delay (75);
digitalWrite (Led1, LOW);
delay (75);
digitalWrite (Led1, HIGH);
delay (75);
digitalWrite (Led1, LOW);
delay (75);
delay (200);

digitalWrite (Led2, HIGH);
delay (75);
digitalWrite (Led2, LOW);
delay (75);
digitalWrite (Led2, HIGH);
delay (75);
digitalWrite (Led2, LOW);
delay (75);
delay (200);

digitalWrite (Led3, HIGH);
delay (75);
digitalWrite (Led3, LOW);
delay (75);
digitalWrite (Led3, HIGH);
delay (75);
digitalWrite (Led3, LOW);
delay (75);
delay (200);

digitalWrite (Led4, HIGH);
delay (75);
digitalWrite (Led4, LOW);
delay (75);
digitalWrite (Led4, HIGH);
delay (75);
digitalWrite (Led4, LOW);
delay (75);
delay (200);

digitalWrite (Led5, HIGH);
delay (75);
digitalWrite (Led5, LOW);
delay (75);
digitalWrite (Led5, HIGH);
delay (75);
digitalWrite (Led5, LOW);
delay (75);
delay (200);
}

Shouldn't these be like this?

void  setup(){
pinMode (Led1, OUTPUT);
pinMode (Led5, OUTPUT);
pinMode (Led2, OUTPUT);
pinMode (Led3, OUTPUT);
pinMode (Led4, OUTPUT);
}

Wow, CrossRoads. You know what? That was it! I'm so happy. I replaced my bizarre setup (which was modified from a YT video) with yours, and it works perfectly! Mystery solved. Thank you very much!

I'm curious. Why was the value 3 treaded as OUTPUT for Led4/pin 3 but not for Led3/pin 2?

I think he is getting the pin and led numbers mixed up,. nearly did while trying to respond,. A set of leds 1 number off from their pin numbers is a recipe for confusion.

I'm also not sure what core he's using, heh. unknown values default to,.... OUTPUT?! Am I reading the code right? I'd have gone with INPUT but that is how the official core does it, and how ATTinyCore does it because it's based on that.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.