# LED dimmer not fading out

I'm trying to make an LED go from no brightness to max and back down on a loop and I've encountered a problem I can't seem to crack. The LED will go to maximum brightness steadily as it should but then it will drop to zero brightness and start again... Why?

int blue_led=10;

void setup() {
pinMode(blue_led,OUTPUT);
}

void loop() {

int voltage=0;

for(int i=0;i<=255;i+1){

analogWrite(blue_led,voltage);
voltage=voltage+1;
delay(8);
}
int volts=255;

for(int i=0;i<=255;i+1){

analogWrite(blue_led,volts);
volts=volts-1;
delay(8);
}

}


• i could be used instead of voltage and volts, couldn't it? I mean, is max voltage 255? – brasofilo May 31 '19 at 1:09