     Serial.println(light_state);
   } else if (serial_data == "a" && light_state == "off") {
     light_state = "dimming";
-    dim(1800000, true);
+    //alarm(1800000);
+    alarm(1800000);
   }
 }
 

String light_state;

void serialEvent();
void dim(unsigned long, boolean);

void dim(unsigned long duration, boolean brighten) {
  double lnb = log(pow(256.0, 1.0 / (float) duration));
  for (int i = 1; i < 256; i++) {
    if (light_state != "dimming") {
      return;
    }
    unsigned long interval;
    if (brighten) {

  } else {
    light_state = "off";
  }
  return true;
}

void serialEvent() {
  String serial_data = Serial.readString();
  Serial.flush();
  if (serial_data == "i") {
    Serial.println(light_state);
  } else if (light_state == "alarm" && serial_data == "o") {
    light_state = "on";
    Serial.println(light_state);
  } else if (light_state != "on" && serial_data == "o") {
    light_state = "dimming";
