diff --git a/src/schrittmotor.py b/src/schrittmotor.py index ad315ad..7be8c8b 100644 --- a/src/schrittmotor.py +++ b/src/schrittmotor.py @@ -5,7 +5,7 @@ import threading import math GPIO.setmode(GPIO.BCM) -#GPIO.setwarnings(False) +GPIO.setwarnings(False) class motor(): @@ -26,6 +26,7 @@ class motor(): self.freq_halten = freq_halten self.cyc_halten = cyc_halten + def start(self): GPIO.setup(self.sp1, GPIO.OUT) GPIO.setup(self.sp2, GPIO.OUT) GPIO.setup(self.sp3, GPIO.OUT) @@ -41,24 +42,18 @@ class motor(): self.pwm3.start(0) if self.halten == 1: - self.pwm4 = GPIO.PWM(self.sp4, self.freq) + self.pwm4 = GPIO.PWM(self.sp4, self.freq_halten) self.pwm4.start(cyc_halten) else: self.pwm4 = GPIO.PWM(self.sp4, self.freq) self.pwm4.start(0) - print(str(self.sp4)) - print(str(self.pwm4)) - def vorwaerts(self, schritte): ges_schritte = schritte * 8 #print(str(ges_schritte)) - print(str(self.halten)) - + if self.halten == 1: - self.pwm4.ChangeFrequency(self.freq_halten) - self.pwm4.stop() - print(dir(self.pwm4)) + self.pwm4.ChangeFrequency(self.freq) for i in range(int(schritte)): if self.pos >= self.schritte_max: