I want help with the coding for a group project

Okay so basically I am trying to make an app for my school group project I'm using an Arduino uno for a smart green house and I'm using a water level sensor, gas sensor ,temperature sensor and a servo motor. i want the data I'm receiving from my sensors to show on the app and when I click a button the servo motor activates. I also plan on making the app send alerts to the phone when the water level is too low and when the co2 increases in the greenhouse.

this is my code in the Arduino so far:

// Define the pin connections
#define MOISTURE_SENSOR_PIN A0 // Analog pin for soil moisture sensor
#define PUMP_RELAY_PIN 7 // Digital pin for controlling the water pump via relay

// Define the moisture threshold
#define MOISTURE_THRESHOLD 500 // Adjust this value according to your soil moisture sensor

#include <SoftwareSerial.h>

const int waterSensorPin = 8; // Analog pin connected to the water level sensor
const int bluetoothTx = 3; // Arduino's TX pin connected to HC-05's RX pin
const int bluetoothRx = 2; // Arduino's RX pin connected to HC-05's TX pin

SoftwareSerial bluetoothSerial(bluetoothTx, bluetoothRx);

int sensorPin = A5; // Analog input pin connected to the MQ-2 sensor
float sensorValue = 0; // Variable to store sensor value

#include "Servo.h"

Servo myservo;
#define servoPin 5

void setup() {
// Initialize the pump relay pin
digitalWrite(PUMP_RELAY_PIN, LOW); // Make sure the pump is initially off

pinMode(waterSensorPin, INPUT);
pinMode(bluetoothTx, OUTPUT);
pinMode(bluetoothRx, INPUT);


Serial.begin(9600); // Start serial communication for debugging
bluetoothSerial.begin(9600); // Start Bluetooth serial communication

void loop() {
// Check soil moisture level
int moistureLevel = analogRead(MOISTURE_SENSOR_PIN);

// Check if moisture level is below threshold
if (moistureLevel < MOISTURE_THRESHOLD) {
// Activate the pump
digitalWrite(PUMP_RELAY_PIN, HIGH);
delay(5000); // Run the pump for 5 seconds (adjust as needed)
digitalWrite(PUMP_RELAY_PIN, LOW); // Turn off the pump


int waterLevel = analogRead(waterSensorPin);
float voltage = waterLevel * (5.0 / 1023.0); // Convert analog reading to voltage
float waterPercentage = map(voltage, 0.0, 5.0, 0, 100); // Map voltage to percentage

Serial.print("Water Level: ");

// Send data to Bluetooth module
bluetoothSerial.print("Water Level: ");

delay(1000); // Delay for stability

sensorValue = analogRead(sensorPin); // Read analog value from sensor
float Voltage = sensorValue * (5.0 / 1023.0); // Convert analog value to voltage

// Convert voltage to CO2 concentration (you may need to adjust these values)
// The MQ-2 sensor is not specifically calibrated for CO2, so this will be an approximation
// You may need to calibrate it using known CO2 concentration levels
float ppm = map(Voltage, 0.2, 4.0, 0, 2000);

Serial.print("CO2 Level: ");
Serial.println(" ppm");

bluetoothSerial.print("CO2 Level: ");
bluetoothSerial.println(" ppm");

delay(1000); // Delay before next reading (adjust as needed)


and here is on the app:

note: I'm using HC-05 Bluetooth module

I don't understand much about coding so if someone could help me finish this i would appreciate it.

Be sure to use println() at the end of each message to send from the sending device, to signal end of message.

Only use print() in the middle of a message.

Be sure not to println() in the middle of a message, or you will break it into two short messages and mess up the item count after you split the message in AI2.

Do not rely on timing for this, which is unreliable.

In the AI2 Designer, set the Delimiter attribute of the BlueTooth Client component to 10 to recognize the End of Line character.
Also, return data is not immediately available after sending a request,
you have to start a Clock Timer repeating and watch for its arrival in the Clock Timer event. The repeat rate of the Clock Timer should be faster than the transmission rate in the sending device, to not flood the AI2 buffers.

In your Clock Timer, you should check

  Is the BlueTooth Client still Connected?
  Is Bytes Available > 0?
     IF Bytes Available > 0 THEN
       set message var  to BT.ReceiveText(-1) 

This takes advantage of a special case in the ReceiveText block:

Receive text from the connected Bluetooth device. If numberOfBytes is less than 0, read until a delimiter byte value is received.

If you are sending multiple data values per message separated by | or comma, have your message split into a local or global variable for inspection before trying to select list items from it. Test if (length of list(split list result) >= expected list length) before doing any select list item operations, to avoid taking a long walk on a short pier. This bulletproofing is necessary in case your sending device sneaks in some commentary messages with the data values.

Some people send temperature and humidity in separate messages with distinctive prefixes like "t:" (for temperature) and "h:" (for humidity).
(That's YAML format.)

The AI2 Charts component can recognize these and graph them. See Bluetooth Client Polling Rate - #12 by ABG

To receive YAML format messages, test if the incoming message contains ':' . If true, split it at ':' into a list variable, and find the prefix in item 1 and the value in item 2.