I have written the following code for RGB LED:-
const int RED =11;
const int GREEN = 10;
const int BLUE= 9;
void setup() {
pinMode(RED,OUTPUT);
pinMode(GREEN,OUTPUT);
pinMode(BLUE,OUTPUT);
}
void loop() {
analogWrite(RED,0);
analogWrite(GREEN,255);
analogWrite(BLUE,0);
delay(1000);
}
Now according to my understanding if I run the above code then only pin named GREEN
i.e. 10th pin will give me current not 9, 11th pin. But when I upload the code and run it I see that 9 and 11 pin are giving me current not 10th pin as it is supposed to. Is there a problem in my code? I have checked my circuits are correct. To check current I took jumper wire that was connected to one of my colour and tried inserting it's other end at pins(9, 10 or 11) of Arduino board. If there is current bulb will glow. For above code the bulb was glowing when I inserted the wire at 9 and 11th pin.