Strawberry_Greenhouse_V1.0
Dependencies: mbed C12832 Servo HCSR04 DHT DHT11
Diff: main.cpp
- Revision:
- 1:81cec44cec2e
- Parent:
- 0:c48b28944702
- Child:
- 2:2621304bdec1
--- a/main.cpp Tue Oct 12 19:23:55 2021 +0000 +++ b/main.cpp Tue Oct 19 17:14:52 2021 +0000 @@ -11,7 +11,6 @@ PwmOut r (p23); // r = red LED PwmOut g (p24); // g = green LED - int main() { @@ -32,6 +31,7 @@ lcd.cls(); //clear LCD + Timer timer; { @@ -41,7 +41,7 @@ - lcd.print_bm(bitmEmptyTank,80,0); // print Empty Tank at location x=85, y=0 + lcd.print_bm(bitmEmptyTank,80,0); // print Empty Tank at location x=80, y=0 lcd.copy_to_lcd(); //if needed: lcd.locate(0,10); //if needed: lcd.printf("Min. range = %g cm\n\rMax. range = %g cm\n\r", @@ -63,10 +63,11 @@ wait_ms(500 - timer.read_ms()); // time the loop //turn RGB LED red if distance >400mm - if( sensor.getDistance_mm()< 400) r=1; //red light on + + if( sensor.getDistance_mm()< 400) r= 1; //red light on else r = 0; - if( sensor.getDistance_mm()> 400) g=1; //green light on + if( sensor.getDistance_mm()> 400) g=1; //green light on else g=0; //green light off @@ -93,6 +94,7 @@ if( sensor.getDistance_mm() > 440 ) lcd.print_bm(bitmEmptyTank,80,0); //empty tank lcd.copy_to_lcd(); + } }