Hauptprogramm
Dependencies: ILI9340_Driver_Lib PM2_Libary Lib_DFPlayerMini
Diff: main.cpp
- Revision:
- 27:bbcd157dcd63
- Parent:
- 26:caa4fab7023e
- Child:
- 29:91df2c5fb297
--- a/main.cpp Wed Apr 28 14:58:37 2021 +0000 +++ b/main.cpp Sun May 02 19:50:46 2021 +0000 @@ -9,7 +9,7 @@ #include "servo_bewegung.h" //include Feuchtigkeitssensor -#include "soil_tester.h" +#include "Chirp.h" //LED Anzeige //#include "clock_display.h" @@ -30,18 +30,18 @@ }; -I2CPreInit gI2C(I2C_SDA, I2C_SCL); +I2CPreInit gI2C(PB_9, PB_8); //Adafruit_7segment clockDisplay = Adafruit_7segment(); //clockDisplay.begin(DISPLAY_ADDRESS); //bool blinkColon = false; using namespace std::chrono; -InterruptIn user_button(USER_BUTTON); +InterruptIn user_button(USER_BUTTON); DigitalOut led(LED1); -//BufferedSerial pc(SERIAL_TX, SERIAL_RX); -//I2C i2c(PB_9, PB_8); // i2c1 pins +BufferedSerial pc(SERIAL_TX, SERIAL_RX); +I2C i2c(PB_9, PB_8); // i2c1 pins bool executeMainTask = false; Timer user_button_timer, loop_timer; @@ -69,8 +69,7 @@ loop_timer.reset(); if (executeMainTask) { - soil_test(); - + getResults(); //Zeitfunktion uhrzeit(time(NULL)); @@ -81,7 +80,7 @@ //2 Minuten case 120: seconds += 5; //Seesaw Programm - soil_test(); + getResults(); ThisThread::sleep_for(5s); //Wartet 5s.. break; //5 Minuten @@ -112,62 +111,6 @@ } } } -/*void clock_display(){ - //int displayValue = hours*100 + minutes; - - // Now print the time value to the display. - clockDisplay.print(displayValue, DEC); - - // Add zero padding when in 24 hour mode and it's midnight. - // In this case the print function above won't have leading 0's - // which can look confusing. Go in and explicitly add these zeros. - if (TIME_24_HOUR && hours == 0) { - // Pad hour 0. - clockDisplay.writeDigitNum(1, 0); - // Also pad when the 10's minute is 0 and should be padded. - if (minutes < 10) { - clockDisplay.writeDigitNum(2, 0); - } - } - - // Blink the colon by flipping its value every loop iteration - // (which happens every second). - blinkColon = !blinkColon; - clockDisplay.drawColon(blinkColon); - - // Now push out to the display the new values that were set above. - clockDisplay.writeDisplay(); - - // Pause for a second for time to elapse. This value is in milliseconds - // so 1000 milliseconds = 1 second. - delay(1000); - - // Now increase the seconds by one. - seconds += 1; - // If the seconds go above 59 then the minutes should increase and - // the seconds should wrap back to 0. - if (seconds > 59) { - seconds = 0; - minutes += 1; - // Again if the minutes go above 59 then the hour should increase and - // the minutes should wrap back to 0. - if (minutes > 59) { - minutes = 0; - hours += 1; - // Note that when the minutes are 0 (i.e. it's the top of a new hour) - // then the start of the loop will read the actual time from the DS1307 - // again. Just to be safe though we'll also increment the hour and wrap - // back to 0 if it goes above 23 (i.e. past midnight). - if (hours > 23) { - hours = 0; - } - } - }}*/ - - - - - void button_fall() { @@ -182,4 +125,4 @@ if (t_button_ms > 200) { executeMainTask = !executeMainTask; } -} +} \ No newline at end of file