I have a simple program that takes in three inputs to make respective LED's at pin 11,12 and 13 as the OUTPUT pins. If I make them HIGH usually they glow pretty bright but when I switch them from the Program given below, the LED's are very dull and dont even glow brightly. I am not able to understand what's going wrong. The program is as follows :-
/*
This is a typical program which would be used to test the
if conditions and execute the program in accordance to the
condition.
*/
#define baudRate 9600
//Declaring Variables for LED's
int redLed = 11;
int blueLed = 12;
int whiteLed = 13;
//This takes up the value coming up from serial port and is used for comparison
char switchOption;
//Calling setup in order to initialize
void setup(){
//Next we initialize the pinMode
pinMode(redLed,LOW);
pinMode(blueLed,LOW);
pinMode(whiteLed,LOW);
//Next we begin the SerialCommunication by fixing the baudRate
Serial.begin(baudRate);
//Print status whether the Serial Comunication started
Serial.println("Communication started...");
}
//Loop in order to iterate across the entire program
void loop(){
//Checking if there is data in the Serial Port
if(Serial.available())
{
//Reading from serial
switchOption = Serial.read();
//Sending input to the switching function
switchLogic(switchOption);
}
}
//Switching logic using if Statements
void switchLogic(char option){
if(option=='r'){
digitalWrite(redLed,HIGH);
digitalWrite(whiteLed,LOW);
digitalWrite(blueLed,LOW);
}
if(option=='w'){
digitalWrite(redLed,LOW);
digitalWrite(whiteLed,HIGH);
digitalWrite(blueLed,LOW);
}
if(option=='b'){
digitalWrite(redLed,LOW);
digitalWrite(whiteLed,LOW);
digitalWrite(blueLed,HIGH);
}
}
Please help me to understand if I am doing something wrong due to which there is a voltage drop at those PINS?