initialize sensor objects in constructor

This commit is contained in:
interfisch 2021-11-07 22:05:57 +01:00
parent 4dbc5b186c
commit c5bad1cc44
6 changed files with 8 additions and 4 deletions

View File

@ -5,7 +5,7 @@
Sensor_BH1750::Sensor_BH1750()
{
BH1750 bh1750(0x23); //0x23 if addr connected to ground (=pin open), 0x5c if addr pulled high
bh1750 = new BH1750(0x23); //0x23 if addr connected to ground (=pin open), 0x5c if addr pulled high
}
void Sensor_BH1750::init() //Things to be done during setup()

View File

@ -5,7 +5,7 @@
Sensor_BMP180::Sensor_BMP180()
{
Adafruit_BMP085 bmp180;
bmp180 = new Adafruit_BMP085();
}
void Sensor_BMP180::init() //Things to be done during setup()

View File

@ -6,7 +6,7 @@
Sensor_HTU21D::Sensor_HTU21D()
{
Adafruit_HTU21DF htu;
htu = new Adafruit_HTU21DF();
}
void Sensor_HTU21D::init() //Things to be done during setup()

View File

@ -7,6 +7,9 @@ Sensor_MHZ19B::Sensor_MHZ19B(int prx,int ptx)
pin_rx=prx;
pin_tx=ptx;
mhz19 = new MHZ19();
mhz19_swSerial = new SoftwareSerial();
/*
* MHZ19 Library: https://platformio.org/lib/show/1620/SevSegSPI
* Software Serial Library: https://platformio.org/lib/show/168/EspSoftwareSerial

View File

@ -25,7 +25,6 @@ private:
int mhz19_readValue_reimplemented(Stream *_streamRef, MHZ19 *_mhz19Ref);
byte mhz19_getCheckSum(byte* packet);
bool mhz19_ready;
MHZ19 *mhz19;

View File

@ -10,6 +10,8 @@ Sensor_SDS018::Sensor_SDS018(int prx,int ptx)
{
pin_rx=prx;
pin_tx=ptx;
sds018_swSerial = new SoftwareSerial();
}
void Sensor_SDS018::init() //Things to be done during setup()