 uint8_t previousLamp[255] = {0};
 uint8_t previousDim[9] = {0};
 
+uint8_t storedLamp[255] = {0};
+
 uint8_t previousButtons_XPT[22] = {0};
 uint8_t previousButtons_DSK[8] = {0};
 uint8_t previousButtons_DSK_SEC[5] = {0};

          break;
      }
    } else {
      if(buffer[0]=='a') {
        Serial.println(readAnalog(atoi(buffer+1)));
      } else if(buffer[0]=='!') resetFunc();
    }
    memset(buffer, 0, BUFFER_SIZE);
  }

  }
}

void storeandclearLamps() {
  memcpy(storedLamp,previousLamp,256);
  for(int i=0;i<397;i++) writeLamp(i,0);
}

void restoreLamps() {
  // 0 all lamps
  for(int i=0;i<397;i++) writeLamp(i,0);
  // now write out to addresses that have data in (then we don't accidentally set displays/dimmers
  for(int i=0;i<256;i++) {
    if(storedLamp[i]) {
      sendData(i,storedLamp[i]);
    }
  }
}

void setup() {
  Serial.begin(115200);
  
