aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Detector-Building.ino17
1 files changed, 17 insertions, 0 deletions
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);
+ }
}