This commit is contained in:
Alexander 2023-12-17 15:59:01 -05:00
parent 57a00b7aea
commit 430f6dcefc
4 changed files with 12 additions and 6 deletions

View File

@ -0,0 +1,2 @@
BMP280 comes in 3.3V and 5V versions. 5V version is I2C and has 4 terminals; 3.3V version is IPS and has 6 terminals.
AHT10 Arduino sensor

After

Width:  |  Height:  |  Size: 138 B

View File

@ -15,6 +15,7 @@ framework = arduino
monitor_speed = 115200
lib_deps =
knolleary/PubSubClient@^2.8
adafruit/Adafruit Unified Sensor@^1.1.9
adafruit/Adafruit BME280 Library@^2.2.2
adafruit/Adafruit BMP280 Library@^2.6.6

View File

@ -1,7 +1,7 @@
// Uncomment modules as required
//#define RTC
//#define MICRO_SD
//#define BMP280 // Adafruit BMP280; temp & pressure
#define BMP280 // Adafruit BMP280; temp & pressure
//#define BME280 // Generic BME280; temp, pressure & humidity
/*
BME-280

View File

@ -19,6 +19,7 @@
#include "config.h"
#ifdef BME280
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#endif
#ifdef BMP280
@ -43,13 +44,12 @@ Adafruit_BME280 bme;
#ifdef BMP280
// I2C setup
Adafruit_BMP280 bmp();
/*
// BMP280 SPI setup
#define BMP_SCK (18)
#define BMP_MISO (19)
#define BMP_MOSI (23)
#define BMP_CS (5)
//Adafruit_BMP280 bmp(BMP_CS);*/
//Adafruit_BMP280 bmp(BMP_CS);
#endif
// Mosquitto
@ -223,6 +223,9 @@ void setup() {
pinMode(PING_PIN, OUTPUT);
pinMode(SWITCH_1, OUTPUT);
pinMode(SWITCH_2, OUTPUT);
pinMode(21, PULLUP);
pinMode(22, PULLUP);
pinMode(FAN_RPM, INPUT);
digitalWrite(FAN_RPM, HIGH);
@ -239,7 +242,7 @@ void setup() {
Serial.println("Scanning I2C bus ...");
// Scan I2C bus
byte address;
/*byte address;
for (address = 1; address < 127; address++)
{
Serial.print("Address: ");
@ -252,11 +255,11 @@ void setup() {
else if (Wire.endTransmission() == 4)
Serial.println("I2C unknown error.");
delay(150); //500
}
}*/
// WaveShare BME280
#ifdef BME280
unsigned status = bme.begin(); // 0x76
unsigned status = bme.begin(0x76); // 0x76
if (!status) {
Serial.println("Could not find a valid BME/BMP280 sensor, check wiring!");
Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID());//,16);