1
0

Refactor project structure: update Java version, remove MQ7 files, and add BMP280 support

This commit is contained in:
Jose
2025-04-11 10:02:05 +02:00
parent bbec62aac9
commit b02d3539cb
14 changed files with 99 additions and 38 deletions

View File

@@ -1,31 +0,0 @@
#include "MQ7.hpp"
float sensor_volt;
float RS_air;
float R0;
float sensorValue;
void MQ7_init() {
pinMode(digitalMQ7, INPUT);
pinMode(analogMQ7, INPUT);
}
void MQ7_read() {
analogWrite(analogMQ7, 1023);
delay(60000);
analogWrite(analogMQ7, (1023/5)*1.4 );
for(int i = 0; i<100; i++){
sensorValue = sensorValue + analogRead(analogMQ7);
delay(90000);
}
sensorValue = sensorValue/100.0;
sensor_volt = sensorValue/1024*5.0;
RS_air = (5.0-sensor_volt)/sensor_volt;
R0 = RS_air/(26+(1/3));
Serial.print("R0 = ");
Serial.println(R0);
delay(1000);
}

View File

@@ -1,4 +1,4 @@
#include "mqtt.hpp"
#include "MqttClient.hpp"
// MQTT configuration
WiFiClient espClient;

View File

@@ -1,8 +1,19 @@
#include "main.hpp"
const uint32_t deviceId = getChipID();
String response;
// instances
HTTPClient httpClient;
BMP280_DEV bme;
// HTTP Request
String response;
// MQ7
float sensorVolt, sensorValue, RSAir, R0;
// BMP280
float temperature, humidity, pressure, altitude;
uint32_t getChipID()
{
@@ -22,13 +33,11 @@ void setup() {
Serial.print("Error connecting to WiFi");
}
MQ7_init();
// test get
getRequest(httpClient, "http://172.20.10.7:8082/api/v1/sensors/1/values", response);
deserializeSensorValue(httpClient, httpClient.GET());
}
void loop() {
MQ7_read();
}

View File

@@ -1,2 +0,0 @@
#include "rest.hpp"