I’m trying to make a Christmas themed LED project using Attiny13.
But I have problems.
The code works differently when I run the same code with 3 batteries and 1 battery.In the code I wrote, the LEDs must first blink sequentially and then all together. The code works correctly [https://hizliresim.com/no3dqv8](First picture) with 3 batteries. But when I run the code with 1 battery [https://hizliresim.com/ghfc0i2](Second picture), only the 1st LED lights up and nothing else happens.
The same happens when I reduce the number of LEDs from 10 to 4. I was wondering if the battery was not strong enough.
Some people have made similar projects with more LEDs than this with 1 battery. What do you think is the problem? Hardware? Software?
#define LED_PIN_1 0
#define LED_PIN_2 1
#define LED_PIN_3 2
#define LED_PIN_4 3
#define LED_PIN_5 4
void setup() {
pinMode(LED_PIN_1, OUTPUT);
pinMode(LED_PIN_2, OUTPUT);
pinMode(LED_PIN_3, OUTPUT);
pinMode(LED_PIN_4, OUTPUT);
pinMode(LED_PIN_5, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN_1, HIGH);
digitalWrite(LED_PIN_2, LOW);
digitalWrite(LED_PIN_3, LOW);
digitalWrite(LED_PIN_4, LOW);
digitalWrite(LED_PIN_5, LOW);
delay(1000);
digitalWrite(LED_PIN_1, HIGH);
digitalWrite(LED_PIN_2, HIGH);
digitalWrite(LED_PIN_3, LOW);
digitalWrite(LED_PIN_4, LOW);
digitalWrite(LED_PIN_5, LOW);
delay(1000);
digitalWrite(LED_PIN_1, HIGH);
digitalWrite(LED_PIN_2, HIGH);
digitalWrite(LED_PIN_3, HIGH);
digitalWrite(LED_PIN_4, LOW);
digitalWrite(LED_PIN_5, LOW);
delay(1000);
digitalWrite(LED_PIN_1, HIGH);
digitalWrite(LED_PIN_2, HIGH);
digitalWrite(LED_PIN_3, HIGH);
digitalWrite(LED_PIN_4, HIGH);
digitalWrite(LED_PIN_5, LOW);
delay(1000);
digitalWrite(LED_PIN_1, HIGH);
digitalWrite(LED_PIN_2, HIGH);
digitalWrite(LED_PIN_3, HIGH);
digitalWrite(LED_PIN_4, HIGH);
digitalWrite(LED_PIN_5, HIGH);
delay(1000);
digitalWrite(LED_PIN_1, LOW);
digitalWrite(LED_PIN_2, LOW);
digitalWrite(LED_PIN_3, LOW);
digitalWrite(LED_PIN_4, LOW);
digitalWrite(LED_PIN_5, LOW);
delay(1000);
digitalWrite(LED_PIN_1, HIGH);
digitalWrite(LED_PIN_2, HIGH);
digitalWrite(LED_PIN_3, HIGH);
digitalWrite(LED_PIN_4, HIGH);
digitalWrite(LED_PIN_5, HIGH);
delay(1000);
digitalWrite(LED_PIN_1, LOW);
digitalWrite(LED_PIN_2, LOW);
digitalWrite(LED_PIN_3, LOW);
digitalWrite(LED_PIN_4, LOW);
digitalWrite(LED_PIN_5, LOW);
delay(1000);
digitalWrite(LED_PIN_1, HIGH);
digitalWrite(LED_PIN_2, HIGH);
digitalWrite(LED_PIN_3, HIGH);
digitalWrite(LED_PIN_4, HIGH);
digitalWrite(LED_PIN_5, HIGH);
delay(1000);
digitalWrite(LED_PIN_1, LOW);
digitalWrite(LED_PIN_2, LOW);
digitalWrite(LED_PIN_3, LOW);
digitalWrite(LED_PIN_4, LOW);
digitalWrite(LED_PIN_5, LOW);
delay(1000);
}