diff options
author | Anthony Wang | 2022-02-12 13:17:04 -0600 |
---|---|---|
committer | Anthony Wang | 2022-02-12 13:17:04 -0600 |
commit | 25e740001974758deb3e45c3ac552191c75df491 (patch) | |
tree | 93c64845aba06c4876842e995d9bea49986f365b /Detector-Building.ino | |
parent | 9c39dce0570d10eaa9fb026a621c8a663c511848 (diff) |
Diffstat (limited to 'Detector-Building.ino')
-rw-r--r-- | Detector-Building.ino | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Detector-Building.ino b/Detector-Building.ino index b2c49d3..382178b 100644 --- a/Detector-Building.ino +++ b/Detector-Building.ino @@ -52,26 +52,30 @@ void setup() { ++n; } - fitCurve(order, n, vol, con, order + 1, coeff); + Serial.println(fitCurve(order, n, vol, con, order + 1, coeff)); for (int i = 0; i <= order; ++i) Serial.println(coeff[i]); + Serial.println("Calibration done"); } void loop() { - double v = a2d(analogRead(THERM)); - double c = 0; - for (int i = 0; i <= order; --i) c = v*c + coeff[i]; + Serial.println("Testing"); + double v = a2d(analogRead(THERM)); Serial.print("Voltage: "); Serial.println(v); - Serial.print("Conductivity: "); + + double c = 0; + for (int i = 0; i <= order; ++i) c = v*c + coeff[i]; + + Serial.print("Concentration: "); Serial.println(c); - if (c <= 100) { + if (c <= 50000) { digitalWrite(LED_R, LOW); digitalWrite(LED_G, LOW); digitalWrite(LED_B, HIGH); } - else if (c <= 200) { + else if (c <= 15000) { digitalWrite(LED_R, LOW); digitalWrite(LED_G, HIGH); digitalWrite(LED_B, LOW); |