Hauptprogramm
Dependencies: ILI9340_Driver_Lib PM2_Libary Lib_DFPlayerMini
main.cpp
- Committer:
- ackerden
- Date:
- 2021-04-17
- Revision:
- 14:153f377f4030
- Parent:
- 13:096e5dc3ac23
- Child:
- 15:babdd038715a
File content as of revision 14:153f377f4030:
#include "mbed.h" //#include "mbed_rtc_time.h" //Eigene Header einbinden #include "realtimer.h" using namespace std::chrono; InterruptIn user_button(USER_BUTTON); DigitalOut led(LED1); bool executeMainTask = false; Timer user_button_timer, loop_timer; /* declaration of custom button functions */ void button_fall(); void button_rise(); int main() { set_time(1618332129); //Zeit setzen int i = 0; user_button.fall(&button_fall); user_button.rise(&button_rise); loop_timer.start(); while (true) { loop_timer.reset(); if (executeMainTask) { //Zeitfunktion uhrzeit(time(NULL)); //Zeitfunktionen if (i != 360){ ThisThread::sleep_for(5s); //Wartet 5s.. printf("%d\n", i); } else{ i=0; } i += 5; led = !led; } else { led = 0; } } } void button_fall() { user_button_timer.reset(); user_button_timer.start(); } void button_rise() { int t_button_ms = duration_cast<milliseconds>(user_button_timer.elapsed_time()).count(); user_button_timer.stop(); if (t_button_ms > 200) { executeMainTask = !executeMainTask; } }