aboutsummaryrefslogtreecommitdiff
path: root/Detector-Building.ino
diff options
context:
space:
mode:
Diffstat (limited to 'Detector-Building.ino')
-rw-r--r--Detector-Building.ino18
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);