diff --git a/main.py b/main.py index 5496032..2e67dc1 100644 --- a/main.py +++ b/main.py @@ -5,12 +5,9 @@ from flask_socketio import SocketIO from tfluna import TFLuna from bmp180 import BMP180 from mpu6050 import mpu6050 -from picamera2 import Picamera2 -import io -import base64 import random -# App initalization +# Here, we create the neccesary base app. You don't need to worry about this. app = Flask(__name__) socketio = SocketIO(app) @@ -20,10 +17,6 @@ mpu = mpu6050(0x68) tfluna = TFLuna() tfluna.open() tfluna.set_samp_rate(10) -picam2 = Picamera2 -camera_config = picam2.create_preview_configuration(main={"size": (640,480)}) -picam2.configure(camera_config) -picam2.start() # tfl Class to format the getters like the other sensors. class tfl: @@ -77,15 +70,6 @@ def handle_connect(): print('Client connected') socketio.start_background_task(target=background_thread) -@socketio.on('request_image') -def handle_image_request(): - stream = io.BytesIO() - picam2.capture_file(stream, format='jpeg') - stream.seek(0) - b64_image = base64.b64encode(stream.read()).decode('utf-8') - socketio.emit('new_image', {'image_data': b64_image}) - print("Image sent") - # This function is called def main(): # These specific arguments are required to make sure the webserver is hosted in a consistent spot, so don't change them unless you know what you're doing. diff --git a/templates/index.html b/templates/index.html index 5d60cac..f283daa 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5,24 +5,25 @@ Team 2B2T Drone + +

Team 2B2T Drone

-

Connection Status: Loading...

+

Random Number (lost connection if stopped): Loading...

+

Barometric Sensor Values

Temperature: Loading...

Pressure: Loading...

Altitude: Loading...

+

Accelerometer Sensor Values

Acceleration: Loading...

Gyroscope: Loading...

+

Lidar Sensor Values

Distance: Loading...

Strength: Loading...

Temperature: Loading...

-

Camera

- -
- Live from Pi!