# data[].attributes.body
#include "DHT.h"

// DHT22 센서 설정

#define DHTPIN 23 // ESP32의 23번 핀에 연결

#define DHTTYPE DHT22 // DHT22 타입 사용

// DHT 객체 초기화

DHT dht(DHTPIN, DHTTYPE);

void setup() {

Serial.begin(9600); // 시리얼 통신 속도 설정

dht.begin(); // 센서 초기화

}

void loop() {

// 센서로부터 온도와 습도 읽기

float humidity = dht.readHumidity();

float temperature = dht.readTemperature();

// 읽기 오류 검사

if (isnan(humidity) || isnan(temperature)) {

Serial.println("Failed to read from DHT sensor!");

return;

}

// 온도와 습도를 시리얼 모니터에 출력

Serial.print("Humidity: ");

Serial.print(humidity);

Serial.print("% Temperature: ");

Serial.print(temperature);

Serial.println("°C");

// 2초마다 측정

delay(2000);

}

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyAPEp5rK3QOlelOoG6h-EodGfQrdZLGpdk",
authDomain: "youjin-511d9.firebaseapp.com",
databaseURL: "https://youjin-511d9-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "youjin-511d9",
storageBucket: "youjin-511d9.appspot.com",
messagingSenderId: "547558092667",
appId: "1:547558092667:web:63d81c4e27dbc5a5b757de",
measurementId: "G-1HLB02FPN4"
};

# data[].attributes.headline
유진의 데이터베이스에 연결한 코드

# data[].attributes.subject
유진의 데이터베이스에 연결한 코드

# data[].attributes.body
#include <WiFi.h>

#include <FirebaseESP32.h>

#include <Adafruit_Sensor.h>

#include <DHT.h>

#define WIFI_SSID "G22-018S"

#define WIFI_PASSWORD "micah1088"

// Firebase 설정

#define FIREBASE_HOST "https://youjin-511d9-default-rtdb.asia-southeast1.firebasedatabase.app"

#define FIREBASE_AUTH "AIzaSyAPEp5rK3QOlelOoG6h-EodGfQrdZLGpdk"

// DHT 설정

#define DHTPIN 13

#define DHTTYPE DHT22

// DHT 객체 생성

DHT dht(DHTPIN, DHTTYPE);

// Firebase 객체 생성

FirebaseData firebaseData;

FirebaseAuth auth;

FirebaseConfig config;

void setup() {

// 시리얼 통신 시작

Serial.begin(115200);

// WiFi 연결

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

Serial.print("Connecting to WiFi");

while (WiFi.status() != WL_CONNECTED) {

delay(500);

Serial.print(".");

}

Serial.println(" connected!");

// DHT 센서 초기화

dht.begin();

// Firebase 설정

config.host = FIREBASE_HOST;

config.signer.tokens.legacy_token = FIREBASE_AUTH;

// Firebase 연결

Firebase.begin(&config, &auth);

Firebase.reconnectWiFi(true);

}

void loop() {

// 데이터 읽기 전 짧은 지연 시간

delay(2000);

// 온도와 습도 데이터 읽기

float humidity = dht.readHumidity();

float temperature = dht.readTemperature();

// 읽기 오류 확인

if (isnan(humidity) || isnan(temperature)) {

Serial.println("Failed to read from DHT sensor!");

return;

}

// 시리얼 모니터에 출력

Serial.print("Temperature: ");

Serial.print(temperature);

Serial.print(" °C, Humidity: ");

Serial.print(humidity);

Serial.println(" %");

// Firebase에 데이터 전송

if (Firebase.ready()) {

Firebase.setFloat(firebaseData, "/temperature", temperature);

Firebase.setFloat(firebaseData, "/humidity", humidity);

}

}

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyB5fxuFRU0VU3ZcLjxiolOxSJu7lHoYsvw",
authDomain: "yulchan.firebaseapp.com",
databaseURL: "https://yulchan-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "yulchan",
storageBucket: "yulchan.appspot.com",
messagingSenderId: "165708233805",
appId: "1:165708233805:web:9700b1a10b554e28de3004",
measurementId: "G-6SHJZ8TSKS"
};

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyDocc82GTWgNk2XqSZjigv3AJgzM9PlGm8",
authDomain: "jeha-66706.firebaseapp.com",
databaseURL: "https://jeha-66706-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "jeha-66706",
storageBucket: "jeha-66706.appspot.com",
messagingSenderId: "878115918955",
appId: "1:878115918955:web:8af0e95b00729f2fabcd2e",
measurementId: "G-GQDB7BETFQ"
};

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyA419JnoYiZJU0-8DpcmDAWG_2JhNyT9IM",
authDomain: "hyowon240615.firebaseapp.com",
databaseURL: "https://hyowon240615-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "hyowon240615",
storageBucket: "hyowon240615.appspot.com",
messagingSenderId: "1034679406278",
appId: "1:1034679406278:web:20437815a8c50d6d0a51c7",
measurementId: "G-DZFVLKHB2N"
};

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyASOm2KIpceV28w1cRn7PCF5EYhCddVxvU",
authDomain: "yoonhaneul-b3fe1.firebaseapp.com",
databaseURL: "https://yoonhaneul-b3fe1-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "yoonhaneul-b3fe1",
storageBucket: "yoonhaneul-b3fe1.appspot.com",
messagingSenderId: "513744527799",
appId: "1:513744527799:web:48314cb376a1000bc50832",
measurementId: "G-5VZJZFZ78R"
};

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyC5_woRkR9t9Vmn8SwSNFNSnEnxflJOFH0",
authDomain: "hue-1f93f.firebaseapp.com",
databaseURL: "https://hue-1f93f-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "hue-1f93f",
storageBucket: "hue-1f93f.appspot.com",
messagingSenderId: "257693864440",
appId: "1:257693864440:web:1b9579abec87b2d704c60d",
measurementId: "G-PPG96JTPFP"
};

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyB-4v4JUpNzh9FOSdj_ZA9YLVSI24npZYQ",
authDomain: "youwon-b7f0e.firebaseapp.com",
databaseURL: "https://youwon-b7f0e-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "youwon-b7f0e",
storageBucket: "youwon-b7f0e.appspot.com",
messagingSenderId: "1040114044408",
appId: "1:1040114044408:web:82dff2f4a826679495da0d",
measurementId: "G-4BVDX0JFGN"
};

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyDaWfNg5BJ7EhwWeyHZrGMQUq1-eeFZkm4",
authDomain: "gavroche-e6bdb.firebaseapp.com",
databaseURL: "https://gavroche-e6bdb-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "gavroche-e6bdb",
storageBucket: "gavroche-e6bdb.appspot.com",
messagingSenderId: "971431957932",
appId: "1:971431957932:web:98b694066050b76af89609",
measurementId: "G-5MWLJFNY3M"
};

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyC7yfAVpFMu-qIe-opO_lCjuTsgChW74-E",
authDomain: "hye-sung.firebaseapp.com",
databaseURL: "https://hye-sung-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "hye-sung",
storageBucket: "hye-sung.appspot.com",
messagingSenderId: "202051505143",
appId: "1:202051505143:web:204416ca9a26e8e8947cf2",
measurementId: "G-N6NHCTS5GS"
};

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyDWNjc9lJfK8Qg0Lc2flq5CIXGNgU-Vj4s",
authDomain: "chanjin-a4334.firebaseapp.com",
databaseURL: "https://chanjin-a4334-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "chanjin-a4334",
storageBucket: "chanjin-a4334.appspot.com",
messagingSenderId: "140773783920",
appId: "1:140773783920:web:88f383a4fe7523686f37b5",
measurementId: "G-2SQ5VKGBH3"
};

# data[].attributes.body
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

# data[].attributes.body
const firebaseConfig = {
apiKey: "AIzaSyB7qMIR9JDHqX32nVUDV1CN50rsA9dcx2g",
authDomain: "leejunseo-1f51b.firebaseapp.com",
databaseURL: "https://leejunseo-1f51b-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "leejunseo-1f51b",
storageBucket: "leejunseo-1f51b.appspot.com",
messagingSenderId: "685666327026",
appId: "1:685666327026:web:2651e4385be1f91686336b",
measurementId: "G-GVSTHM4145"
};

# data[].attributes.attachment_link.description
광탄중학교 온습도 센서 알리미 제작자 : 이준서 제작날짜: 2024년 6월 15일