Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from MotorBridgeI import MotorBridgeCape
- from flask import Flask, render_template
- import time
- # DC Motors
- MotorName1 = 1
- MotorName2 = 2
- MotorName3 = 3
- MotorName4 = 4
- ClockWise = 1
- CounterClockWise = 2
- PwmDuty = 100
- Frequency = 1000
- # Servo Motors
- #ServoName1 = 1
- #ServoName6 = 6
- #Frequency2 = 50
- #Angle1 = 0
- #Angle2 = 45
- #Angle3 = 90
- #Angle4 = 135
- #Angle5 = 180
- app = Flask(__name__)
- @app.route("/")
- @app.route("/<state>")
- def updates(state=None):
- time.sleep(0.5)
- motor = MotorBridgeCape()
- motor.DCMotorInit(MotorName1, Frequency)
- motor.DCMotorInit(MotorName2, Frequency)
- motor.DCMotorInit(MotorName3, Frequency)
- motor.DCMotorInit(MotorName4, Frequency)
- #motor.ServoInit(ServoName1, Frequency2)
- #motor.ServoInit(ServoName6, Frequency2)
- # while True:
- if state == "F":
- motor.DCMotorMove(MotorName1, ClockWise, PwmDuty)
- motor.DCMotorMove(MotorName2, ClockWise, PwmDuty)
- motor.DCMotorMove(MotorName3, ClockWise, PwmDuty)
- motor.DCMotorMove(MotorName4, ClockWise, PwmDuty)
- template_data = {
- "title" : state,
- }
- return render_template("ServoKing.html", **template_data)
- if __name__ == "__main__":
- app.run(host="0.0.0.0", port=5000, debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement