Advertisement
silver2row

Some end source in Flask

Jan 30th, 2021
1,219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. app = Flask(__name__)
  2.  
  3. @app.route("/")
  4. def homepage(title="homepage"):
  5.     return render_template("BootGo.html", title=title)
  6.  
  7. def add_motors_route(state, v1, v2, v3, v4):
  8.     @app.route("/" + state, endpoint=state)
  9.     def handler():
  10.         set_motors(v1, v2, v3, v4)
  11.         return homepage(title=state)
  12.  
  13. add_motors_route("0",        0,   0,   0,         0)
  14. add_motors_route("25",       25,  25,  25,       25)
  15. add_motors_route("35",       35,  35,  35,       35)
  16. add_motors_route("45",       45,  45,  45,       45)
  17. add_motors_route("55",       55,  55,  55,       55)
  18. add_motors_route("65",       65,  65,  65,       65)
  19. add_motors_route("75",       75,  75,  75,       75)
  20. add_motors_route("90",       90,  90,  90,       90)
  21. add_motors_route("100",      100, 100, 100,     100)
  22. add_motors_route("1",        1,   1,     1,       1)
  23. add_motors_route("-25",     -25, -25,   -25,    -25)
  24. add_motors_route("-35",     -35, -35,   -35,    -35)
  25. add_motors_route("-45",     -45, -45,   -45,    -45)
  26. add_motors_route("-55",     -55, -55,   -55,    -55)
  27. add_motors_route("-65",     -65, -65,   -65,    -65)
  28. add_motors_route("-75",     -75, -75,   -75,    -75)
  29. add_motors_route("-90",     -90, -90,   -90,    -90)
  30. add_motors_route("-100",    -100, -100, -100,  -100)
  31.  
  32. if __name__ == "__main__":
  33.     app.run(host="0.0.0.0", port=5000, debug=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement