Skip to content
Snippets Groups Projects
Commit ab553e44 authored by Moritz Perschke's avatar Moritz Perschke
Browse files

added basic implementation of abstract sensor class, scd30 implementation of...

added basic implementation of abstract sensor class, scd30 implementation of it and a file to define all pins
parent 80c4062b
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
#ifndef _FORTE_SENSOR
#define _FORTE_SENSOR
class Forte_Sensor {
public:
virtual void* read_data() = 0;
virtual void setup() = 0;
private:
};
#endif
\ No newline at end of file
#ifndef _FORTE_PINOUT
#define _FORTE_PINOUT
// Pins for I2C
#define I2C_SDA 18
#define I2C_SCL 19
#endif
\ No newline at end of file
#include "scd30.hpp"
#include "Wire.h"
#include <SparkFun_SCD30_Arduino_Library.h>
void Forte_SCD30 :: setup(){
Wire.begin(I2C_SDA, I2C_SCL);
if(!airSensor.begin()){
// Sensor init went wrong
return;
}
}
float* Forte_SCD30 :: read_data(){
float data[3];
data[0] = airSensor.getCO2();
data[1] = airSensor.getTemperature();
data[2] = airSensor.getHumidity();
return data;
}
\ No newline at end of file
#ifndef _SCD30
#define _SCD30
#include <forte_sensor.hpp>
#include <pinout.hpp>
#include <SparkFun_SCD30_Arduino_Library.h>
class Forte_SCD30 : public Forte_Sensor{
public:
void setup();
float* read_data();
private:
SCD30 airSensor;
};
#endif
\ No newline at end of file
......@@ -12,3 +12,5 @@
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino
lib_deps = sparkfun/SparkFun SCD30 Arduino Library@^1.0.18
Wire
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