Skip to content
Snippets Groups Projects
Commit cfa844f0 authored by Bilal Hassan's avatar Bilal Hassan
Browse files

small improvments

parent ab553e44
No related branches found
No related tags found
5 merge requests!39Merge Develop into Main,!19development into master,!17Inital Host, initial Client,!10merge serial comm and sd write into espnow,!2Draft: Read Sensors on ESP32 Client device
......@@ -3,4 +3,3 @@
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
!lib/
......@@ -11,9 +11,16 @@ void Forte_SCD30 :: setup(){
}
float* Forte_SCD30 :: read_data(){
float data[3];
data[0] = airSensor.getCO2();
data[1] = airSensor.getTemperature();
data[2] = airSensor.getHumidity();
return data;
if(airSensor.dataAvailable()==true)
{
data[0] = airSensor.getCO2();
data[1] = airSensor.getTemperature();
data[2] = airSensor.getHumidity();
return data;
}
else
return 0;
}
\ No newline at end of file
......@@ -4,6 +4,7 @@
#include <pinout.hpp>
#include <SparkFun_SCD30_Arduino_Library.h>
class Forte_SCD30 : public Forte_Sensor{
public:
void setup();
......@@ -11,6 +12,7 @@ class Forte_SCD30 : public Forte_Sensor{
private:
SCD30 airSensor;
float data[3];
};
#endif
\ No newline at end of file
#include <Arduino.h>
#include <scd30.hpp>
Forte_SCD30 sensor1; //without adding frte_sensor + to the local lib/scd30 i error appears
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
sensor1.setup();
}
void loop() {
// put your main code here, to run repeatedly:
float* data;
data=sensor1.read_data();
if(data!=0)
{
Serial.println("C02"); Serial.println(data[0]);
Serial.println("Temperatur"); Serial.println(data[1]);
Serial.println("Humidity"); Serial.println(data[2]);
Serial.println();
}
else
Serial.println("waiting for data");
delay(3000);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment