Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Scientific_RTOS Scientific_RTOS
Revision 4:d9c5d93963a8, committed 2019-09-05
- 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 |
diff -r 442e7d2ab496 -r d9c5d93963a8 BOX.cpp
--- 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);
}
diff -r 442e7d2ab496 -r d9c5d93963a8 BOX.h --- 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();