Hauptprogramm
Dependencies: ILI9340_Driver_Lib PM2_Libary Lib_DFPlayerMini
Servo/servo_bewegung.cpp
- Committer:
- haefeman
- Date:
- 2021-04-22
- Revision:
- 19:9ccd591cb637
- Parent:
- 17:621c4212fd4e
- Child:
- 20:f825e91784fe
File content as of revision 19:9ccd591cb637:
#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_ns(STEP); } for (int pos = 2000; pos > 1000; pos -= 25) { servo1.SetPosition(pos); wait_ns(STEP); } } }