Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KC868-A4S ESP32 I/O pin define
#6
(10-11-2023, 11:54 PM)admin Wrote: set SDA,SCL pin define as this photo.

so, like this ? ....

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>



#define SEALEVELPRESSURE_HPA (1013.25)
#define SDA  4
#define SCL  16

Adafruit_BME280 bme; // I2C

unsigned long delayTime;

void setup() {
    Serial.begin(9600);
    while(!Serial);    // time to get serial running
    Serial.println(F("BME280 test"));

    unsigned status;
 
    status = bme.begin(); 
 
    status = bme.begin(0x76);
    if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
        Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
        Serial.print("        ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
        Serial.print("  ID of 0x56-0x58 represents a BMP 280,\n");
        Serial.print("        ID of 0x60 represents a BME 280.\n");
        Serial.print("        ID of 0x61 represents a BME 680.\n");
        while (1) delay(10);
    }
   
    Serial.println("-- Default Test --");
    delayTime = 1000;

    Serial.println();
}


void loop() {
    printValues();
    delay(delayTime);
}


void printValues() {
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" °C");

    Serial.print("Pressure = ");

    Serial.print(bme.readPressure() / 100.0F);
    Serial.println(" hPa");

    Serial.print("Approx. Altitude = ");
    Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
    Serial.println(" m");

    Serial.print("Humidity = ");
    Serial.print(bme.readHumidity());
    Serial.println(" %");

    Serial.println();
}
Reply


Messages In This Thread
KC868-A4S ESP32 I/O pin define - by admin - 03-01-2023, 04:52 AM
RE: KC868-A4S ESP32 I/O pin define - by admin - 10-11-2023, 10:30 PM
RE: KC868-A4S ESP32 I/O pin define - by admin - 10-11-2023, 11:54 PM
RE: KC868-A4S ESP32 I/O pin define - by DanielGuerrero - 10-12-2023, 03:09 AM
RE: KC868-A4S ESP32 I/O pin define - by Denilson - 01-04-2025, 08:25 PM
RE: KC868-A4S ESP32 I/O pin define - by admin - 01-05-2025, 01:09 AM
RE: KC868-A4S ESP32 I/O pin define - by Denilson - 01-05-2025, 02:36 PM
RE: KC868-A4S ESP32 I/O pin define - by admin - 01-05-2025, 10:18 PM
RE: KC868-A4S ESP32 I/O pin define - by Denilson - 01-06-2025, 12:26 AM
RE: KC868-A4S ESP32 I/O pin define - by admin - 01-06-2025, 01:09 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)