Scientific task box V1
Dependents: Scientific_RTOS Scientific_RTOS
Diff: BOX.cpp
- Revision:
- 4:d9c5d93963a8
- Parent:
- 3:442e7d2ab496
--- a/BOX.cpp Mon Jun 10 13:11:22 2019 +0000 +++ b/BOX.cpp Thu Sep 05 20:55:56 2019 +0000 @@ -60,16 +60,16 @@ int BOX::get_resistance() { AnalogIn cond_value(_pincond); // reads voltage on the conductimeter pin. - float meas_v; - float current; + /* float meas_v; + float current;*/ float resistance; _tmp = 0; for(int i = 0; i < 20; i++) { - meas_v = cond_value.read(); // Read the analog input value (value from 0.0 to 1.0 = full ADC conversion range) - current = (1 - meas_v) / (2000000); // kvl and V/R to get current + resistance = cond_value.read(); // Read the analog input value (value from 0.0 to 1.0 = full ADC conversion range) + /*current = (1 - meas_v) / (2000000); // kvl and V/R to get current _tmp = (meas_v / current); // Ohm law gives us the soil resistence - resistance = resistance + _tmp; + resistance = resistance + _tmp;*/ } return (int) (resistance / 20); }