Complete library for whole scientific pre-final
Dependencies: BOX_1
Diff: main.cpp
- Revision:
- 4:f693e434d21c
- Parent:
- 3:7c5d4da549ce
- Child:
- 5:b0fa65791218
diff -r 7c5d4da549ce -r f693e434d21c main.cpp --- a/main.cpp Mon Jun 10 15:28:07 2019 +0000 +++ b/main.cpp Tue Jun 11 12:57:01 2019 +0000 @@ -2,26 +2,52 @@ #include "ENVIROMENTAL.h" DigitalOut led(LED3); I2C i2c(D14,D15); -BOX m_box (D14,D15,D8,A0,5,D3); +BOX box1 (D14,D15,D8,A0,5,D3); +BOX box2 (D14,D15,D6,A0,5,D3); +BOX box3 (D14,D15,D4,A0,5,D3); +BOX box4 (D14,D15,D2,A0,5,D3); ENVIROMENTAL envi(D14, D15,A1,i2c); int main(){ //BOX *m_box = new BOX(D1,D2,D3,A0,5); - m_box.initialize(); +box1.initialize(); + box2.initialize(); + box3.initialize(); + box4.initialize(); while(1) { int i,j,k; - led = 1; // LED is ON - wait(1); // 200 ms - led = 0; // LED is OFF - wait(0.8); // 800 ms float t; -t=m_box.get_temp(); //return temperature from DS18B20 - float a; - a=m_box.get_weight(); //return weight in g from hx711 - //m_box->get_resistance();//return soil resistance - m_box.tare(); //sets tare on HX711 library + int a; + t=box1.get_temp(); //return temperature from DS18B20 + a=box1.get_resistance();//return soil resistance //t=m_box.get_resistance(); - printf("temp %f weight %f\n\r",t,a); + printf("temp %f res %d\n\r",t,a); + wait(1); + t=box2.get_temp(); //return temperature from DS18B20 + a=box2.get_resistance();//return soil resistance + + printf("temp %f res %d\n\r",t,a); + wait(1); + + t=box3.get_temp(); //return temperature from DS18B20 + a=box3.get_resistance();//return soil resistance + + printf("temp %f res %d\n\r",t,a); + wait(1); + + t=box4.get_temp(); //return temperature from DS18B20 + a=box4.get_resistance();//return soil resistance + + printf("temp %f res %d\n\r",t,a); + wait(1); + + + + + /* + + + t=envi.get_temp(); //return temperature from SI7021 i=envi.get_humidity(); //return humidity from SI7021 j=envi.get_pressure(); //return pressure in Pa from MBP280 @@ -30,5 +56,5 @@ printf("temp %f hum %d pres %d co %f lux %d\n\r",t,i,j,a,k); } - -} \ No newline at end of file + */ +}} \ No newline at end of file