#define SENSOR_PIN A0
#define LASER_PIN D5

int maxVal = 0;

void setup() {
  pinMode(SENSOR_PIN, INPUT);
  pinMode(LASER_PIN, OUTPUT);
  digitalWrite(LASER_PIN, HIGH);
  Serial.begin(115200);
}

void loop() {
  int tmp = analogRead( SENSOR_PIN );
  if (tmp > maxVal) {
    Serial.print("Last value : ");
    Serial.println(maxVal);
    Serial.print("New value : ");
    Serial.println(tmp);
    maxVal = tmp;
  }
  delay(500);
}
