Hauptprogramm
Dependencies: ILI9340_Driver_Lib PM2_Libary Lib_DFPlayerMini
Diff: Servo/servo_bewegung.cpp
- Revision:
- 16:f0480e9c5039
- Child:
- 17:621c4212fd4e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo/servo_bewegung.cpp Wed Apr 21 13:48:47 2021 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "Servo.h" + +#include "servo_bewegung.h" + +#define MID 1500 +#define MIN 1000 +#define MAX 2000 +#define STEP 50 +//Time delay between steps in milliseconds +#define TIME 100 + + +void bewegung(int zeit){ + +Servo Servo1(PA_0); +Servo1.Enable(1500,20000); + for(int j=0; j<zeit; j++){ + for (int pos = 1000; pos < 2000; pos += 25) { + Servo1.SetPosition(pos); + wait_ms(STEP); + } + for (int pos = 2000; pos > 1000; pos -= 25) { + Servo1.SetPosition(pos); + wait_ms(STEP); + } + } +}