Keep PWM signal in loop with other things

I currently builded this:

and now looking into State Change detection

int usaStatus = 0;

void loop()
{
  delay(100);
  if (digitalRead(usaPin) == HIGH) { //if toggler is ON
    if (usaStatus == 0) {
      analogWrite(usaoutPin, map(usalight, 0, 100, 0, 255)); //set PWM of usa lights
      usaStatus = 1;
    }
  }
  else //if toggler is off
  {
    if (usaStatus == 1) {
      analogWrite(usaoutPin, 0); //set off usa lights
      usaStatus = 0;
    }
  }