mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-04 04:14:58 +00:00
wrote message and connect function for the mqtt connection to pi
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from flask import Flask, render_template
|
||||
from flask import Flask, request, render_template
|
||||
import paho.mqtt.publish as publish
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@@ -6,12 +7,11 @@ app = Flask(__name__)
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/control', methods=['POST'])
|
||||
def control():
|
||||
return("hello")
|
||||
|
||||
@app.route('/move', methods=['POST'])
|
||||
def move():
|
||||
direction = request.form['direction']
|
||||
publish.single("home/commands", direction, hostname="ishak.ishakpi.ddns.net")
|
||||
return "Message sent"
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
|
||||
|
||||
app.run(debug=True)
|
@@ -4,13 +4,15 @@
|
||||
<img src="kobuki.jpg" alt="Kobuki Robot" id="robot-image" />
|
||||
</div>
|
||||
<div class="button-section">
|
||||
<button class="btn">←</button>
|
||||
<button class="btn">↑</button>
|
||||
<button class="btn">→</button>
|
||||
<button class="btn">↓</button>
|
||||
<form action="/move" method="post">
|
||||
<button class="btn" name="direction" value="left">←</button>
|
||||
<button class="btn" name="direction" value="up">↑</button>
|
||||
<button class="btn" name="direction" value="right">→</button>
|
||||
<button class="btn" name="direction" value="down">↓</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<h1>Sensor Data</h1>
|
||||
<h1>Sensor Data</h1>
|
||||
</div>
|
||||
{%endblock%}
|
||||
|
Reference in New Issue
Block a user