from flask import Flask, send_from_directory
from flask_socketio import SocketIO
import time
import threading
import os
import serial
# Serial Configuration (Modify COM Port if needed)
SERIAL_PORT = "COM3"
BAUD_RATE = 115200
app = Flask(__name__, static_folder="../frontend/dist")
socketio = SocketIO(app, cors_allowed_origins="*") # Allow all origins for development
# Serve the index html
@app.route("/")
def index():
return send_from_directory(app.static_folder, "index.html")
# Serve static files (JS, CSS, etc.) from the Vite build
@app.route("/<path:path>")
def static_files(path):
return send_from_directory(app.static_folder, path)
def emit_data():
print("