From 54871f203e455fc72320b4335839bf1543ba87b4 Mon Sep 17 00:00:00 2001 From: Ta180m Date: Sun, 9 Feb 2020 14:04:37 -0600 Subject: Update Detector_Building.ino --- Detector_Building/Detector_Building.ino | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Detector_Building/Detector_Building.ino b/Detector_Building/Detector_Building.ino index 43ac562..44d0dc8 100644 --- a/Detector_Building/Detector_Building.ino +++ b/Detector_Building/Detector_Building.ino @@ -17,6 +17,14 @@ const int LED_R = 4, LED_G = 3, LED_B = 2, THERM = 0; // Device component pins const double R_k = 10000, V_in = 5, analog_max = 1023; // Device constants +// Calibration data +const int n = 3, m = n / 3; // Number of data points, MUST be multiple of 3 +double V[n] = { 2.12, 3.26, 3.96 }; // Voltage measurements +double T[n] = { 22.0, 39.15, 60 }; // Temperature measurements +double V_mid[m]; // Stores each piecewise segment for binary search +double A[m], B[m], C[m]; // Coefficients for each piecewise component + + // Temperature conversions inline double f2c(double f) { return (f - 32) * 5 / 9; } // Fahrenheit to Celsius inline double c2f(double c) { return c * 9 / 5 + 32; } // Celsius to Fahrenheit @@ -49,14 +57,6 @@ void sort(double a[], int n) { } -// Calibration data -const int n = 3, m = n / 3; // Number of data points, MUST be multiple of 3 -double V[n] = { 2.12, 3.26, 3.96 }; // Voltage measurements -double T[n] = { 22.0, 39.15, 60 }; // Temperature measurements -double V_mid[m]; // Stores each piecewise segment for binary search -double A[m], B[m], C[m]; // Coefficients for each piecewise component - - // Calculations // Steinhart-hart stuff void calculate() { -- cgit v1.2.3-70-g09d2