  * Color = blink green twice
  */
 void connectingSuccess() {
-  Serial.println("connected!");
+  debug_println("connected!");
   Serial.print ("IP address: ");
   Serial.println (WiFi.localIP());
 

void setup() {

  Serial.begin(115200);
  Serial.println(F("LIFX bulb emulator for Esp8266 starting up..."));

  // WIFI
  WiFiManager wifiManager;

// print out a LifxPacket data structure as a series of hex bytes - used for DEBUG
void printLifxPacket(LifxPacket &pkt) {
  // size
  debug_print(lowByte(LifxPacketSize + pkt.data_size), HEX);
  debug_print(SPACE);
  debug_print(highByte(LifxPacketSize + pkt.data_size), HEX);
  debug_print(SPACE);

  // protocol
  debug_print(lowByte(pkt.protocol), HEX);
  debug_print(SPACE);
  debug_print(highByte(pkt.protocol), HEX);
  debug_print(SPACE);

  // reserved1
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);

  // bulbAddress mac address
  for (int i = 0; i < sizeof(mac); i++) {
    debug_print(lowByte(mac[i]), HEX);
    debug_print(SPACE);
  }

  // reserved2
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);

  // site mac address
  for (int i = 0; i < sizeof(site_mac); i++) {
    debug_print(lowByte(site_mac[i]), HEX);
    debug_print(SPACE);
  }

  // reserved3
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);

  // timestamp
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);

  //packet type
  debug_print(lowByte(pkt.packet_type), HEX);
  debug_print(SPACE);
  debug_print(highByte(pkt.packet_type), HEX);
  debug_print(SPACE);

  // reserved4
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);
  debug_print(lowByte(0x00), HEX);
  debug_print(SPACE);

  //data
  for (int i = 0; i < pkt.data_size; i++) {
    debug_print(pkt.data[i], HEX);
    debug_print(SPACE);
  }
}

void setLight() {
  debug_print(F("Set light - "));
  debug_print(F("hue: "));
  debug_print(hue);
  debug_print(F(", sat: "));
  debug_print(sat);
  debug_print(F(", bri: "));
  debug_print(bri);
  debug_print(F(", kel: "));
  debug_print(kel);
  debug_print(F(", power: "));
  debug_print(power_status);
  debug_println(power_status ? " (on)" : "(off)");

  if (power_status) {
    int this_hue = map(hue, 0, 65535, 0, 767);
