 }
 
 void blink(unsigned long interval) {
-  unsigned int previousMillis;
+  unsigned long previousMillis;
   light_state = "blink";
   while(light_state == "blink") {
     digitalWrite(gate_pin, LOW);

  pinMode(gate_pin, OUTPUT);
  analogWrite(gate_pin, 0);
  light_state = "off";
  Serial.begin(9600);
}


  } else {
    light_state = "off";
  }
  Serial.println(light_state);
  return true;
}

void serialEvent() {
  String serial_data = Serial.readString();
  long serial_num = serial_data.toInt();
  Serial.flush();
  if (serial_data == "i") {
    Serial.println(light_state);
  } else if (serial_num >= 300000l) {
    alarm(serial_num);
  } else if (serial_num != 0){
    dim(serial_num);
  }
}

