Hauptprogramm
Dependencies: ILI9340_Driver_Lib PM2_Libary Lib_DFPlayerMini
main.cpp
- Committer:
- ackerden
- Date:
- 2021-04-17
- Revision:
- 13:096e5dc3ac23
- Parent:
- 12:dfa3591affef
- Child:
- 14:153f377f4030
File content as of revision 13:096e5dc3ac23:
#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 user_button.fall(&button_fall); user_button.rise(&button_rise); loop_timer.start(); while (true) { loop_timer.reset(); if (executeMainTask) { //Zeitfunktion uhrzeit(time(NULL)); ThisThread::sleep_for(5s); //Wartet 5s. 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; } }