Advertisement
F-Rogers

Untitled

Oct 11th, 2024
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. from flask import Flask, render_template, request
  2. from sense_hat import SenseHat
  3.  
  4. app = Flask(__name__)
  5. sense = SenseHat()
  6.  
  7. @app.route('/')
  8. def index():
  9.     return render_template('index.html')
  10.  
  11. @app.route('/send', methods=['POST'])
  12. def send():
  13.     text = request.form['text']
  14.     sense.show_message(text)
  15.     return "Text sent to Sense HAT!"
  16.  
  17. if __name__ == "__main__":
  18.     app.run(host='0.0.0.0')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement