Hauptprogramm

Dependencies:   ILI9340_Driver_Lib PM2_Libary Lib_DFPlayerMini

Committer:
haefeman
Date:
Thu Apr 22 15:57:47 2021 +0000
Revision:
20:f825e91784fe
Parent:
19:9ccd591cb637
Child:
22:f71d32309307
servo in own header

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
haefeman 20:f825e91784fe 14 void bewegung(){
haefeman 20:f825e91784fe 15 Servo servo1(PA_0);
haefeman 20:f825e91784fe 16 servo1.Enable(1000,20000);
haefeman 20:f825e91784fe 17
haefeman 20:f825e91784fe 18 //Servo Bewegung
haefeman 20:f825e91784fe 19 for (int pos = 1000; pos > 800; pos -= 25) {
haefeman 20:f825e91784fe 20 servo1.SetPosition(pos);
haefeman 20:f825e91784fe 21 thread_sleep_for(STEP);
haefeman 20:f825e91784fe 22 }
haefeman 20:f825e91784fe 23 for(int j=0; j<2; j++){
haefeman 20:f825e91784fe 24 for (int pos = 800; pos < 1200; pos += 25) {
haefeman 20:f825e91784fe 25 servo1.SetPosition(pos);
haefeman 20:f825e91784fe 26 thread_sleep_for(STEP);
haefeman 20:f825e91784fe 27 }
haefeman 20:f825e91784fe 28 for (int pos = 1200; pos > 800; pos -= 25) {
haefeman 20:f825e91784fe 29 servo1.SetPosition(pos);
haefeman 20:f825e91784fe 30 thread_sleep_for(STEP);
haefeman 20:f825e91784fe 31 }
haefeman 20:f825e91784fe 32 }
haefeman 20:f825e91784fe 33 for (int pos = 800; pos < 1000; pos += 25) {
haefeman 20:f825e91784fe 34 servo1.SetPosition(pos);
haefeman 20:f825e91784fe 35 thread_sleep_for(STEP);
haefeman 20:f825e91784fe 36 }
haefeman 20:f825e91784fe 37 servo1.Disable();
ackerden 16:f0480e9c5039 38 }