메뉴 건너뛰기

정보자료게시판

장비/디자인/구조

[아두이노] ESP32 - 정밀온습도센서 BME 280 제어

by 라키 posted Nov 19, 2018
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

[아두이노] ESP32 - 정밀온습도센서 BME 280 제어

목표

ESP32로 BME 280 제어하기

제어 테스트 소스

/*********
  Complete project details at http://randomnerdtutorials.com  
*********/

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

/*#include <SPI.h>
#define BME_SCK 18
#define BME_MISO 19
#define BME_MOSI 23
#define BME_CS 5*/

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI

unsigned long delayTime;

void setup() {
    Serial.begin(9600);
    Serial.println(F("BME280 test"));

    bool status;

    // default settings
    // (you can also pass in a Wire library object like &Wire2)
    status = bme.begin(0x76);  
    if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring!");
        while (1);
    }

    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();
}

/***************************************************************************
  This is a library for the BME280 humidity, temperature & pressure sensor

  Designed specifically to work with the Adafruit BME280 Breakout
  ----> http://www.adafruit.com/products/2650

  These sensors use I2C or SPI to communicate, 2 or 4 pins are required
  to interface. The device's I2C address is either 0x76 or 0x77.

  Adafruit invests time and resources providing this open source code,
  please support Adafruit andopen-source hardware by purchasing products
  from Adafruit!

  Written by Limor Fried & Kevin Townsend for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ***************************************************************************/

준비

참고한 자료


  1. 수경재배 | 케일 재배 17일차

    Date2023.01.20 Category사회/생태/환경 BySumma
    Read More
  2. 강화유리문 닫힘 속도 비밀

    Date2023.01.18 Category장비/디자인/구조 BySumma
    Read More
  3. 시놀로지 마리아DB 백업

    Date2023.01.17 Category장비/디자인/구조 BySumma
    Read More
  4. GAS | 메일 발송자 변경하기

    Date2023.01.16 Category장비/디자인/구조 BySumma
    Read More
  5. 수경재배 | 케일 성장 11일차

    Date2023.01.15 Category사회/생태/환경 BySumma
    Read More
  6. 수경재배 | 케일 성장 10일차

    Date2023.01.13 Category사회/생태/환경 BySumma
    Read More
  7. ds photo 시놀로지 포토 사진 모바일에서 링크 따는 법

    Date2023.01.13 Category장비/디자인/구조 BySumma
    Read More
  8. 수경재배 | 케일 성장 9일차

    Date2023.01.13 Category사회/생태/환경 BySumma
    Read More
  9. [수경재배] 케일 성장 8일차

    Date2023.01.11 Category사회/생태/환경 BySumma
    Read More
  10. [수경재배] 케일 성장 7일차

    Date2023.01.11 Category사회/생태/환경 BySumma
    Read More
  11. 목차 애드온

    Date2023.01.10 Category코딩 및 XE 관련 BySumma
    Read More
  12. Draw.io 텍스트 상자 줄바꿈

    Date2023.01.10 Category장비/디자인/구조 BySumma
    Read More
  13. 다이아그램

    Date2023.01.10 BySumma
    Read More
  14. [캠핑장비] 엔트리, 지카로, 메쉬딥과 서드파티 1유닛 거치대 결합

    Date2023.01.09 BySumma
    Read More
  15. 인증서 변경 후 시놀로지 드라이브 클라이언트 동기화 안될때

    Date2022.12.27 BySumma
    Read More
  16. 조테로 zotero ios앱인 papership 페이퍼쉽에서 webdav 에러가 난다

    Date2022.12.26 Category장비/디자인/구조 BySumma
    Read More
  17. 미래에셋페이 교통카드 충전 재개

    Date2022.12.25 BySumma
    Read More
  18. 당뇨 식단

    Date2022.12.25 Category생활/의료/안전 BySumma
    Read More
  19. 네이처하이크 농협 펠릿 펠렛 난로

    Date2022.12.25 Category장비/디자인/구조 BySumma
    Read More
  20. 삼성 컬러레이저 복합기 프린터 무한칩 토너

    Date2022.12.25 BySumma
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 45 Next
/ 45
위로