Hauptprogramm
Dependencies: ILI9340_Driver_Lib PM2_Libary Lib_DFPlayerMini
Diff: main.cpp
- Revision:
- 19:9ccd591cb637
- Parent:
- 18:39be9e19768f
- Child:
- 20:f825e91784fe
--- a/main.cpp Wed Apr 21 14:43:34 2021 +0000 +++ b/main.cpp Thu Apr 22 14:43:14 2021 +0000 @@ -51,16 +51,12 @@ int main() { - //myservo.period_ms(20); - //myservo.pulsewidth_us(MID); //NB in microseconds - set_time(1618332129); //Zeit setzen //Laufvariablen int i = 0; - int zeit = 30; - Servo Servo1(PA_0); - Servo1.Enable(1500,20000); + Servo servo1(PA_0); + servo1.Enable(1000,20000); user_button.fall(&button_fall); user_button.rise(&button_rise); @@ -104,8 +100,19 @@ ThisThread::sleep_for(5s); //Wartet 5s.. break; //5 Minuten - case 300: i += 5; + case 30: i += 5; //Servo Bewegung + for(int j=0; j<2; j++){ + for (int pos = 800; pos < 1200; pos += 25) { + servo1.SetPosition(pos); + thread_sleep_for(STEP); + } + for (int pos = 1200; pos > 800; pos -= 25) { + servo1.SetPosition(pos); + thread_sleep_for(STEP); + } + } + servo1.SetPosition(1000); ThisThread::sleep_for(5s); //Wartet 5s.. break; //7 Minuten @@ -115,8 +122,8 @@ break; //10 Minuten case 600: i = 0; + ThisThread::sleep_for(5s); //Wartet 5s.. break; - ThisThread::sleep_for(5s); //Wartet 5s.. default : i += 5; ThisThread::sleep_for(5s); //Wartet 5s.. break;