motor test

This commit is contained in:
Bernd Reuther 2021-03-04 16:45:10 +01:00
parent ebbf1c1483
commit f2e9ce00ef
2 changed files with 6 additions and 7 deletions

View File

@ -84,8 +84,10 @@ def action(changePin, action):
@kamera_server.route("/position/<motor>/<position>") @kamera_server.route("/position/<motor>/<position>")
def motor_test(motor, position): def motor_test(motor, position):
if motor == "drehen": if motor == "drehen":
#m1.stop() m1.stop()
#m1.start() time.sleep(1)
m1.start()
time.sleep(1)
m1.gehe_zu(int(position)) m1.gehe_zu(int(position))
return 'Drehen: ' + str(m1.pos) return 'Drehen: ' + str(m1.pos)
@ -93,6 +95,3 @@ def motor_test(motor, position):
#if __name__ == "__main__": #if __name__ == "__main__":
# kamera_server.run(host='0.0.0.0') # kamera_server.run(host='0.0.0.0')
application = kamera_server application = kamera_server
try:
while True:

View File

@ -87,7 +87,7 @@ class motor():
einzelschritt(self.pwm4, 1, ges_schritte, temp_pos + 6, temp_t1, temp_t2) einzelschritt(self.pwm4, 1, ges_schritte, temp_pos + 6, temp_t1, temp_t2)
einzelschritt(self.pwm3, 0, ges_schritte, temp_pos + 7, temp_t1, temp_t2) einzelschritt(self.pwm3, 0, ges_schritte, temp_pos + 7, temp_t1, temp_t2)
print(str(self.pos)) #print(str(self.pos))
if self.halten == 1: if self.halten == 1:
self.pwm4.ChangeFrequency(self.freq_halten) self.pwm4.ChangeFrequency(self.freq_halten)
@ -126,7 +126,7 @@ class motor():
einzelschritt(self.pwm4, 1, ges_schritte, temp_pos + 6, temp_t1, temp_t2) einzelschritt(self.pwm4, 1, ges_schritte, temp_pos + 6, temp_t1, temp_t2)
einzelschritt(self.pwm1, 0, ges_schritte, temp_pos + 7, temp_t1, temp_t2) einzelschritt(self.pwm1, 0, ges_schritte, temp_pos + 7, temp_t1, temp_t2)
print(str(self.pos)) #print(str(self.pos))
if self.halten == 1: if self.halten == 1:
self.pwm4.ChangeFrequency(self.freq_halten) self.pwm4.ChangeFrequency(self.freq_halten)