initialize sensor objects in constructor

master
interfisch 1 year ago
parent 4dbc5b186c
commit c5bad1cc44
  1. 2
      include/sensor_bh1750.cpp
  2. 2
      include/sensor_bmp180.cpp
  3. 2
      include/sensor_htu21d.cpp
  4. 3
      include/sensor_mhz19b.cpp
  5. 1
      include/sensor_mhz19b.h
  6. 2
      include/sensor_sds018.cpp

@ -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()

@ -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()

@ -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()

@ -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

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

@ -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()

Loading…
Cancel
Save