aboutsummaryrefslogtreecommitdiff
path: root/Detector-Building.ino
diff options
context:
space:
mode:
authorAnthony Wang2022-02-12 13:17:04 -0600
committerAnthony Wang2022-02-12 13:17:04 -0600
commit25e740001974758deb3e45c3ac552191c75df491 (patch)
tree93c64845aba06c4876842e995d9bea49986f365b /Detector-Building.ino
parent9c39dce0570d10eaa9fb026a621c8a663c511848 (diff)
Fix bugsHEADmaster
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);