motor test
This commit is contained in:
		@@ -81,17 +81,14 @@ def action(changePin, action):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return render_template('main.html', **templateData)
 | 
					    return render_template('main.html', **templateData)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@kamera_server.route("/motor1_test")
 | 
					@kamera_server.route("/<motor>/<position>")
 | 
				
			||||||
def motor_test():
 | 
					def motor_test(motor, position):
 | 
				
			||||||
    #m2.pwm4.ChangeFrequency(freq_halten)
 | 
					    if motor == "drehen":
 | 
				
			||||||
    m1.stop()
 | 
					        m1.stop()
 | 
				
			||||||
    m1.start()
 | 
					        m1.start()
 | 
				
			||||||
    m1.vorwaerts(10)
 | 
					        m1.gehe_zu(int(position))
 | 
				
			||||||
    time.sleep(2)
 | 
					    
 | 
				
			||||||
    m1.rueckwaerts(10)
 | 
					    return 'Drehen: ' + m1.pos
 | 
				
			||||||
    #print('Motortest')
 | 
					 | 
				
			||||||
    # Pass the template data into the template main.html and return it to the user
 | 
					 | 
				
			||||||
    return 'fertig'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
    kamera_server.run(host='0.0.0.0')
 | 
					    kamera_server.run(host='0.0.0.0')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -137,6 +137,14 @@ class motor():
 | 
				
			|||||||
        self.rueckwaerts(self.schritte_max, 1)
 | 
					        self.rueckwaerts(self.schritte_max, 1)
 | 
				
			||||||
        self.pos = 0
 | 
					        self.pos = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def gehe_zu(self, position):
 | 
				
			||||||
 | 
					        temp_schritte = int(position) - self.pos
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if temp_schritte > 0:
 | 
				
			||||||
 | 
					            self.vorwaerts(temp_schritte)
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            self.rueckwaerts(temp_schritte)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def einzelschritt(spule, status, ges_schritte, schritt, t1, t2):
 | 
					def einzelschritt(spule, status, ges_schritte, schritt, t1, t2):
 | 
				
			||||||
    w = (schritt * 100 / (ges_schritte - 1)) * 1.8
 | 
					    w = (schritt * 100 / (ges_schritte - 1)) * 1.8
 | 
				
			||||||
    s = round(math.sin(math.radians(w)), 2)
 | 
					    s = round(math.sin(math.radians(w)), 2)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user