Hauptprogramm

Dependencies:   ILI9340_Driver_Lib PM2_Libary Lib_DFPlayerMini

Committer:
haefeman
Date:
Thu Apr 22 14:43:14 2021 +0000
Revision:
19:9ccd591cb637
Parent:
17:621c4212fd4e
Child:
20:f825e91784fe
implement servo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ackerden 16:f0480e9c5039 1 #include "mbed.h"
ackerden 16:f0480e9c5039 2 #include "Servo.h"
ackerden 16:f0480e9c5039 3
ackerden 16:f0480e9c5039 4 #include "servo_bewegung.h"
ackerden 16:f0480e9c5039 5
ackerden 16:f0480e9c5039 6 #define MID 1500
ackerden 16:f0480e9c5039 7 #define MIN 1000
ackerden 16:f0480e9c5039 8 #define MAX 2000
ackerden 16:f0480e9c5039 9 #define STEP 50
ackerden 16:f0480e9c5039 10 //Time delay between steps in milliseconds
ackerden 16:f0480e9c5039 11 #define TIME 100
ackerden 16:f0480e9c5039 12
ackerden 16:f0480e9c5039 13
ackerden 16:f0480e9c5039 14 void bewegung(int zeit){
ackerden 16:f0480e9c5039 15
haefeman 19:9ccd591cb637 16 Servo servo1(PA_0);
haefeman 19:9ccd591cb637 17 servo1.Enable(1500,20000);
ackerden 16:f0480e9c5039 18 for(int j=0; j<zeit; j++){
ackerden 16:f0480e9c5039 19 for (int pos = 1000; pos < 2000; pos += 25) {
haefeman 19:9ccd591cb637 20 servo1.SetPosition(pos);
ackerden 17:621c4212fd4e 21 wait_ns(STEP);
ackerden 16:f0480e9c5039 22 }
ackerden 16:f0480e9c5039 23 for (int pos = 2000; pos > 1000; pos -= 25) {
haefeman 19:9ccd591cb637 24 servo1.SetPosition(pos);
ackerden 17:621c4212fd4e 25 wait_ns(STEP);
ackerden 16:f0480e9c5039 26 }
ackerden 16:f0480e9c5039 27 }
ackerden 16:f0480e9c5039 28 }