const int led=A2;
int brightness=0;
int fadeamount=2;
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
analogWrite(led,brightness);
brightness=brightness + fadeamount;
if(brightness>=255||brightness<=0){
fadeamount= -fadeamount;
}
delay(30);
}