hi
I am a beginner, really really beginner, so if its a stupid question pleas bear with me.
i am using InduinoX, and I wrote two versions of same sketch but they are not producing the same results.
the sketch was written to make the three on board LEDs blink one by one
void setup()
{
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
// Our Red LED is on pin no 11, Blue LED is on 12 and the White LED is on 13, and we are telling processor to make it an output meaning send some signal.
}
void loop()
{
digitalWrite(11,HIGH); // Telling the processor to send ON signal to pin 11 (Red LED) , in electronics High is ON and LOW is OFF
delay(500); // Wait for half a second
digitalWrite(11, LOW); // Turn the LED OFF
delay(500); // Wait for half a second
digitalWrite(12,HIGH); // Telling the processor to send ON
delay(500); // Wait for half a second
digitalWrite(12, LOW); // Turn the LED OFF
delay(500); // Wait for half a second
digitalWrite(13,HIGH); // Telling the processor to send ON
delay(500); // Wait for half a second
digitalWrite(13, LOW); // Turn the LED OFF
delay(500); // Wait for half a second
}
this is working fine and i am getting full intensity on each LED.
another version
int i ; // verialbe i wich is an integer.
void setup() {
// assinging i as a pin no
pinMode(i, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop()
{
for (i=10 ; i < 14 ; i=i+ 1)// make the value of "i"( pin no ) increase by 1 starting with 10, 10+ 1 =11(Red )first then 11+1 =12 (Blue ) and then 12+1=13( White)
{
digitalWrite(i,HIGH); // turn ON the LED
delay (500); //wait for half a second
digitalWrite(i,LOW);//turn of the LED
delay (500);//wait for half a second
}
}
here i am getting very less intensity of light on each LED?
I can’t understand why its happening.
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.