Scientific task box V1

Dependencies:   HX711 DS1820

Dependents:   Scientific_RTOS Scientific_RTOS

Files at this revision

API Documentation at this revision

Comitter:
Alessio_Zaino
Date:
Thu Sep 05 20:55:56 2019 +0000
Parent:
3:442e7d2ab496
Commit message:
final;

Changed in this revision

BOX.cpp Show annotated file Show diff for this revision Revisions of this file
BOX.h Show annotated file Show diff for this revision Revisions of this file
--- 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);
 }
--- a/BOX.h	Mon Jun 10 13:11:22 2019 +0000
+++ b/BOX.h	Thu Sep 05 20:55:56 2019 +0000
@@ -13,7 +13,9 @@
   BOX (PinName pinCLK_HX711, PinName pinDAT_HX711,PinName pin_temp, PinName pin_cond,int HX711_coefficent,PinName pin_servo);
   float get_temp();    //return temperature from DS18B20
   int get_weight();    //return weight in g from hx711
-  int get_resistance();//return soil resistance
+  int get_resistance();//return voltage on resistor then :
+                       //current = (1 - meas_v) / (2000000); kvl and V/R to get current
+                       //resist = (meas_v / current);    Ohm law gives us the soil resistence 
   void move_servo(float ang);
   void tare(unsigned char times=20);         //sets tare on HX711 library
   void initialize();