diff options
author | Anthony Wang | 2022-02-11 16:12:19 -0600 |
---|---|---|
committer | Anthony Wang | 2022-02-11 16:12:19 -0600 |
commit | e504cfa397b2aee9895c2abfa1ff9b513909a4f4 (patch) | |
tree | a30d19342cafa8e357e210620cf5e323eeab194d /Detector-Building.ino | |
parent | 336892abe36bc66410df4ba7a1ab78cdfe1b861d (diff) |
Control LEDs
Diffstat (limited to 'Detector-Building.ino')
-rw-r--r-- | Detector-Building.ino | 17 |
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); + } } |