Hauptprogramm

Dependencies:   ILI9340_Driver_Lib PM2_Libary Lib_DFPlayerMini

Servo/servo_bewegung.cpp

Committer:
ackerden
Date:
2021-04-21
Revision:
16:f0480e9c5039
Child:
17:621c4212fd4e

File content as of revision 16:f0480e9c5039:

#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);
      }
      }
}