Hi, I'm new to ardu and in general to the micro controllers.
I've purchased Arduino Mega 2560
and I've started to play with the "Blink"
I've encountered a small problem, not sure if it is my approach to the programming,
or what....?
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
int led = 5; //init for pin 5 connected led, leds also connected 6&7
int i = 5; //counter for "for" loop
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
i=5;
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
for(i=5;i<8;i++){
led=i;
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
if (i==8){
i=5;
}
}
}
what i wanted to get is 3 LED's connected to the pins 5,6,7 to light up, one after another.
And LED on pin 5 works ok, but 6 and 7 are very, very, dim. they are tested and working the same way if i'll swap their places.
Please advise.