Can you try this code and see if you can see the LEDs vary brightness?
void setup(){
pinMode(2, INPUT);
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
}
void loop(){
int button = 0;
button = digitalRead(2);
if(button == HIGH){
GlowLightOnce(3);
GlowLightOnce(5);
GlowLightOnce(6);
GlowLightOnce(9);
GlowLightOnce(10);
GlowLightOnce(11);
} else{
analogWrite(3, LOW);
analogWrite(5, LOW);
analogWrite(6, LOW);
analogWrite(9, LOW);
analogWrite(10, LOW);
analogWrite(11, LOW);
}
}
void GlowLightOnce(int bulb) // subroutine applies one fade in - fade out blink of an LED
{
int brightness = 0;
int fadeAmount = 5;
int totalcount = 0;
do
{
analogWrite(bulb, brightness);
brightness = brightness + fadeAmount;
totalcount++;
if (brightness == 255)
{
fadeAmount = -fadeAmount;
}
delay(35);
} while (totalcount < 103);
}