Project Autus - Automated Plant Chamber
Fork of keypad_test by
Autus
This is the codebase accompanying the project Autus.
Autus is an automated growth chamber for plants.
Features
Control Humidity inside chamber wrt to external humidity. Control Temperature inside chamber. ( Peltier Heaters/Coolers ) Water and shower plants. Control soil humidity. Monitor water tanks level (Load Cell)
Code Base Features
Fixed timing and CRC for DHT-11 Sensor. Fixed OneWire bug for ds18b20
Cyclic Executive Scheduler with Priority. Async IPC framework for PC App over bluetooth
Fake RTC systick, I was having some trouble with the on board rtc.
Diff: main.cpp
- Revision:
- 11:f9ffd5ab7e94
- Parent:
- 10:1a0fe96381b0
- Child:
- 12:b3137bb72ef7
diff -r 1a0fe96381b0 -r f9ffd5ab7e94 main.cpp --- a/main.cpp Fri Apr 11 13:42:45 2014 +0000 +++ b/main.cpp Sat Apr 12 06:35:04 2014 +0000 @@ -32,6 +32,7 @@ //TICKERS Ticker timer1ms; Ticker clock_mine; +Timer lcd_timeout; //FLAGS bool startup_flag=true; bool watered_plant1 = false; @@ -44,13 +45,16 @@ float setpoint_soil_humid1 = 0.3 ; float setpoint_soil_humid2 = 0.3 ; +int setpoint_red_lights; +int setpoint_blue_lights; +int setpoint_green_lights; //WINDOWING float window_f = 5 ; int window_i =2 ; //GLOBAL VARS float current_water_level = 0; - +bool screen_timeout=false; //SAFETY LIMITS const float max_peltier_temp = 68 ; //CELCIUS const int MAX_WATERING_TIME_GAP = 20; @@ -73,7 +77,9 @@ //Read value for soil read_soil_humidity(); calc_soil_humid_values(); //values in soil1_humid and soil2_humid perecentages - + soil1_humidity = soil1_humid ; + soil2_humidity = soil2_humid ; + printf("%4.2f \n\r",soil1_humidity); } //****************************Functions that perform tasks************************************** @@ -118,7 +124,7 @@ // Air Humidity Level void airhumidity(){ - if( (setpoint_air_humidity+window_f > inside_humidity) && (setpoint_air_humidity-window_f < inside_humidity) ){ + if( !( (setpoint_air_humidity+window_f > inside_humidity) && (setpoint_air_humidity-window_f < inside_humidity) ) ){ //Turn on Air humidity fan wait(5); @@ -165,7 +171,7 @@ //FOR INTERNAL CLOCK clock_mine.attach(&sec_inc, 1.0); char keypad_value; - + int ui_current_screen = 1; //************************************BOOT SEQUENCE********************* //call LCD boot ui_startup(); @@ -214,6 +220,13 @@ cycleair(); + wait(2); + lcd.cls(); + lcd.locate(0,0); + lcd.printf("Testing Lights"); + //led_test(); + + wait(5); ui_screen1(); wait(5); @@ -225,7 +238,9 @@ //FOR BUZZER timer1ms.attach(&timer1, 0.001); //interrupt attached function(timer) with interval (1 ms) keypad_value = Keypad(); - timer1ms.detach(); + //timer1ms.detach(); + + }//WHILE END