From e504cfa397b2aee9895c2abfa1ff9b513909a4f4 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Fri, 11 Feb 2022 16:12:19 -0600 Subject: Control LEDs --- Detector-Building.ino | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Detector-Building.ino b/Detector-Building.ino index 1f3b04e..498a114 100644 --- a/Detector-Building.ino +++ b/Detector-Building.ino @@ -60,8 +60,25 @@ void loop() { double v = a2d(analogRead(THERM)); double c = 0; for (int i = order; i >= 0; --i) c = v*c + coeff[i]; + Serial.print("Voltage: "); Serial.println(v); Serial.print("Conductivity: "); Serial.println(c); + + if (c <= 100) { + digitalWrite(LED_R, LOW); + digitalWrite(LED_G, LOW); + digitalWrite(LED_B, HIGH); + } + else if (c <= 200) { + digitalWrite(LED_R, LOW); + digitalWrite(LED_G, HIGH); + digitalWrite(LED_B, LOW); + } + else { + digitalWrite(LED_R, HIGH); + digitalWrite(LED_G, LOW); + digitalWrite(LED_B, LOW); + } } -- cgit v1.2.3-70-g09d2