I tried to simplify the sketch to the bone, but still the leds do not power up at the same time.
What's strange, there is no power on one of the Arduino pins.
How I measure:
I set DMM to 20 V mode, put negative terminal on Arduino GND, and positive terminal to the pin I'm interested in.
Is it the correct way?
(Leds' cathodes are grounded, and anodes connected to respective pins through 220 Ohm resistors)
Sketch:
int leds[3] = {9, 5, 3};
void setup() {
Serial.begin(9600);
for (int i = 0; i < 3; i++) {
pinMode(leds[i], OUTPUT);
digitalWrite(leds[i], HIGH);
Serial.println("led" + String(leds[i]));
}
}
void loop() {
// put your main code here, to run repeatedly:
}
OP should start using bytes instead of ints for small values >= 0.
It's a habit to work on so that if you write something big for your board it can fit.
Also --- stop using String variables in small RAM environments. Learn to use C strings for your own good.
Serial.print( F( "led " )); // the F() macro keeps the text in flash, saves 5 bytes
Serial.print( i );
Serial.print( F( " = " ));
Serial.println( leds ); This generates less code than a one-liner using formatting functions.
beshur:
What's strange, there is no power on one of the Arduino pins.
How I measure:
I set DMM to 20 V mode, put negative terminal on Arduino GND, and positive terminal to the pin I'm interested in.
Is it the correct way?
You have to set the pin as OUTPUT and HIGH, default is INPUT LOW.