Interruptible fading LED

'Step one of every assignment involves walking to the junk shelf and finding treasure.'

I have always wanted to make an infinity mirror and a dressing room mirror so the final product ended up being neither!!

Materials used - Arduino 101, Capacitive sensor, 10 LEDs

After connecting 10 LEDs in series and interrupting them with a capacitive touch sensor the mini dressing room mirror was created.

Here's a video

Code -

int led = 9; 
int brightness = 0; 
int fadeAmount = 1; 
int switchpin = A0;
int state = 0;

void setup()

 {
 pinMode(led, OUTPUT);
 pinMode(switchpin, INPUT);
 Serial.begin(115200);
}
void loop() 

{

brightness = brightness + fadeAmount;
 delay(10);

if (brightness <= 0 || brightness >= 255) {
 fadeAmount = -fadeAmount;
 }

state = analogRead(switchpin);
 
 if (state > 1000) {
 analogWrite(led, 255); // turn on the yellow LED
 }

else {
 analogWrite(led, brightness);
 }
//Serial.println(brightness);
//Serial.println(state);
}