Project aiming to make a self-controlled solar reflector
Dependencies: Accelerometer LCD Inverter Algorithm MotorDriver Anemometer GUI ArduinoJson Misc Definitions Pushbutton WebSocketClient temp_fan
Diff: main.cpp
- Revision:
- 6:0b7a6e51cdf8
- Parent:
- 2:944511c6c55f
- Child:
- 7:2b6438e586e6
--- a/main.cpp Tue Mar 02 03:33:03 2021 +0000 +++ b/main.cpp Mon Mar 08 18:25:47 2021 +0000 @@ -5,6 +5,7 @@ //INCLUDES #include "mbed.h" +#include "stdio.h" #include "string" // std::string, std::to_string #include "Accelerometer.h" #include "Anemometer.h" @@ -13,6 +14,7 @@ #include "Defs_Sett.h" #include "Pushbutton.h" #include "LCD.h" +#include <string> #define timer_read_s(x) chrono::duration_cast<chrono::seconds>((x).elapsed_time()).count() @@ -41,10 +43,16 @@ int flag_time = 1, flag_idle = 0; int t_elapsed; int wthres = WIND_THRES_INIT; +char buffer[16]; + +string topL = "CALIBRATE"; +string botL = "PRESS FN"; ti.attach(&checkWind,TICK_WIND); t.start(); //Start timer +lcd.LCD_display(topL, botL); + while(1) { switch(mode) @@ -178,7 +186,7 @@ break; //////////////////////////////////////////////////////////////////////////////// case OP_WSETTING: - lcd.LCD_display("Threshold:",to_string(wthres)); + lcd.LCD_display("Threshold:",""); motor.stop(); ti.detach(); //Disable Wind Safety @@ -200,12 +208,12 @@ if(bt_inc.read() && wthres < WIND_THRES_MAX) { ane.setThres(++wthres); - lcd.LCD_display("Threshold:",to_string(wthres)); + lcd.LCD_display("Threshold:",""); } else if(bt_inc.read() && wthres > WIND_THRES_MIN) { ane.setThres(--wthres); - lcd.LCD_display("Threshold:",to_string(wthres)); + lcd.LCD_display("Threshold:",""); } flag_time = 1; //Set the system in motion once done adjusting