Skip to content
Snippets Groups Projects
Commit cfa844f0 authored by User expired's avatar User expired
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 @@ ...@@ -3,4 +3,3 @@
.vscode/c_cpp_properties.json .vscode/c_cpp_properties.json
.vscode/launch.json .vscode/launch.json
.vscode/ipch .vscode/ipch
!lib/
...@@ -11,9 +11,16 @@ void Forte_SCD30 :: setup(){ ...@@ -11,9 +11,16 @@ void Forte_SCD30 :: setup(){
} }
float* Forte_SCD30 :: read_data(){ float* Forte_SCD30 :: read_data(){
float data[3];
data[0] = airSensor.getCO2();
data[1] = airSensor.getTemperature(); if(airSensor.dataAvailable()==true)
data[2] = airSensor.getHumidity(); {
return data; 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 @@ ...@@ -4,6 +4,7 @@
#include <pinout.hpp> #include <pinout.hpp>
#include <SparkFun_SCD30_Arduino_Library.h> #include <SparkFun_SCD30_Arduino_Library.h>
class Forte_SCD30 : public Forte_Sensor{ class Forte_SCD30 : public Forte_Sensor{
public: public:
void setup(); void setup();
...@@ -11,6 +12,7 @@ class Forte_SCD30 : public Forte_Sensor{ ...@@ -11,6 +12,7 @@ class Forte_SCD30 : public Forte_Sensor{
private: private:
SCD30 airSensor; SCD30 airSensor;
float data[3];
}; };
#endif #endif
\ No newline at end of file
#include <Arduino.h> #include <Arduino.h>
#include <scd30.hpp>
Forte_SCD30 sensor1; //without adding frte_sensor + to the local lib/scd30 i error appears
void setup() { void setup() {
// put your setup code here, to run once: // put your setup code here, to run once:
Serial.begin(9600);
sensor1.setup();
} }
void loop() { void loop() {
// put your main code here, to run repeatedly: // 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