// ELEGOO Lesson 18: conductivity changes an analog signal, not a calibrated depth.
#include <Arduino.h>
const uint8_t SENSOR_PIN = A0;  // A0 names the Mega's first analog input.
int previousPrintedValue = 0;
void setup() {
  Serial.begin(9600);  // USB serial messages use the same baud as PlatformIO Monitor.
}
void loop() {
  const int value = analogRead(SENSOR_PIN);  // A 10-bit reading is between 0 and 1023.
  // abs gives the size of a change in either direction. Exactly 10 does not print.
  if (abs(value - previousPrintedValue) > 10) {
    Serial.print("ADC0 level is ");
    Serial.println(value);  // println adds the newline previously produced by sprintf.
    previousPrintedValue = value;  // Compare against the last printed reading.
  }
}
