constexpr uint8_t LDR_PIN = 34; uint32_t sampleNumber = 0; char condition[16] = "STARTUP"; void readConditionCommand() { if (!Serial.available()) return; String label = Serial.readStringUntil('\n'); label.trim(); if (label.length() > 0 && label.length() < sizeof(condition)) { label.toUpperCase(); label.toCharArray(condition, sizeof(condition)); Serial.printf("CHANGE note=%s retest-required=yes\n", condition); } } void setup() { Serial.begin(115200); analogReadResolution(12); Serial.println("LDR LAB scope=direction-only reference=none"); Serial.println("QUESTION does-light-change-move-the-recorded-signal"); } void loop() { readConditionCommand(); const int raw = analogRead(LDR_PIN); const float voltage = raw * 3.3f / 4095.0f; const bool valid = raw >= 0 && raw <= 4095; sampleNumber++; Serial.printf("EVIDENCE n=%lu id=ldr state=%s raw=%dcount V=%.3f valid=%c\n", sampleNumber, condition, raw, voltage, valid ? 'Y' : 'N'); delay(500); }