What does "Serial2.available()" do in the following code?

#include 

#include 

#define JSON\_SIZE 256

StaticJsonDocument jsonBuffer; // Allocate a buffer to hold the JSON object

#include // To include wifi features
#include // For interfacing Esp32 with firebase
//#include 

FirebaseJson jsonData;

//Provide the token generation process info.
#include "addons/TokenHelper.h"
//Provide the RTDB payload printing info and other helper functions.
#include "addons/RTDBHelper.h"
// Insert your network credentials
#define WIFI\_SSID "dev"
#define WIFI\_PASSWORD "12345678"

// Insert Firebase project API Key
#define API\_KEY "AIzaSyCArX\_bjvbBZE9alXH-58RLlyZGVtXmJGE"

// Insert RTDB URLefine the RTDB URL \*/
#define DATABASE\_URL "https://test-proj-977b8-default-rtdb.asia-southeast1.firebasedatabase.app/"

//Define Firebase Data object
FirebaseData fbdo;

FirebaseAuth auth;
FirebaseConfig config;
bool signupOK = false;
//#define BUTTON\_PIN 2
#define UART\_BAUDRATE 115200
//#define NODE\_ID "esp1"

//volatile bool buttonPressed = false;

//void IRAM\_ATTR buttonInterrupt() {
// buttonPressed = true;
//}

void setup() {
 Serial.begin(UART\_BAUDRATE);

 // Firebase
 WiFi.begin(WIFI\_SSID, WIFI\_PASSWORD);
 Serial.print("Connecting to Wi-Fi");
 while (WiFi.status() != WL\_CONNECTED) {
 Serial.print(".");
 delay(300);
 }
 Serial.println();
 Serial.print("Connected with IP: ");
 Serial.println(WiFi.localIP());
 Serial.println();

 /\* Assign the api key (required) \*/
 config.api\_key = API\_KEY;

 /\* Assign the RTDB URL (required) \*/
 config.database\_url = DATABASE\_URL;

 /\* Sign up \*/
 if (Firebase.signUp(&config, &auth, "", "")) {
 Serial.println("Signin successful 'ok'");
 signupOK = true;
 }
 else {
 Serial.printf("%s\n", config.signer.signupError.message.c\_str());
 }

 /\* Assign the callback function for the long running token generation task \*/
 config.token\_status\_callback = tokenStatusCallback; //see addons/TokenHelper.h

 Firebase.begin(&config, &auth);
 Firebase.reconnectWiFi(true);
 // UART communication
 while (!Serial);
 // pinMode(BUTTON\_PIN, INPUT\_PULLUP);
 // attachInterrupt(digitalPinToInterrupt(BUTTON\_PIN), buttonInterrupt, FALLING);
 Serial2.begin(UART\_BAUDRATE, SERIAL\_8N1, 16 , 17); // RX: GPIO16, TX: GPIO17\
}

void loop() {
 // if (buttonPressed) {
 // Serial.printf("The button on %s is pressed!\n", NODE\_ID);
 // Serial2.print(NODE\_ID);
 // Serial2.println(" button pressed");
 // buttonPressed = false;
 // delay(10);
 // }

if(!Firebase.ready()) {
Serial.println("Firebase not ready");
}

if(!signupOK) {
Serial.println("Signin not successful");
}
 if (Firebase.ready() && signupOK & Serial2.available()) {

// if (jsonData.readFrom(Serial2))
// {
// Serial.println("JSON Data received...");
// jsonData.toString(Serial2, true);
// Serial.println();
// }

 Serial.println("Incoming Data.");
 String sendData = Serial2.readStringUntil('\n');
 deserializeJson(jsonBuffer, sendData); // Deserialize the JSON string to a JSON object
 String chipID = jsonBuffer["chipID"].as();
 int counter = jsonBuffer["counter"].as();
 String message = jsonBuffer["message"].as();
 Serial.printf("Data received: ChipID: %s, Counter: %d, Message: %s\n", chipID.c\_str(), counter, message.c\_str());
//
//
// jsonData = jsonBuffer;
 if (Firebase.RTDB.setStringAsync(&fbdo, "test/string", sendData)) {
 Serial.println("Data sent to DataBase");
 Serial.println("PATH: " + fbdo.dataPath());
 Serial.println("TYPE: " + fbdo.dataType());
 }
 }
}
다음 코드에서 "Serial2.available()"은 어떤 역할을 하나요?#include #포함 #정의 JSON\_SIZE 256StaticJsonDocument jsonBuffer; // JSON 객체를 담을 버퍼를 할당합니다.#포함 // 와이파이 기능을 포함하려면#포함 // Esp32와 파이어베이스 인터페이스용//#include FirebaseJson jsonData;//P 토큰 생성 프로세스 정보를 제공합니다.#include "addons/TokenHelper.h"//RTDB 페이로드 인쇄 정보 및 기타 헬퍼 함수를 제공합니다.#include "addons/RTDBHelper.h"// 네트워크 자격 증명 삽입#define WIFI\_SSID "dev"#define WIFI\_PASSWORD "12345678"// Firebase 프로젝트 API 키 삽입#API\_KEY "AIzaSyCArX\_bjvbBZE9alXH-58RLlyZGVtXmJGE"// RTDB URL 삽입 RTDB URL 정의 \*/#DATABASE\_URL "https://test-proj-977b8-default-rtdb.asia-southeast1.firebasedatabase.app/"//Define Firebase 데이터 객체 정의파이어베이스데이터 fbdo;FirebaseAuth 인증;FirebaseConfig config;bool signupOK = false;//#define BUTTON\_PIN 2#define UART\_BAUDRATE 115200//#define NODE\_ID "esp1"//휘발성 부울 buttonPressed = false;//void IRAM\_ATTR buttonInterrupt() {// buttonPressed = true;//}void setup() { Serial.begin(UART\_BAUDRATE); // Firebase WiFi.begin(WIFI\_SSID, WIFI\_PASSWORD); Serial.print("Wi-Fi에 연결 중"); while (WiFi.status() != WL\_CONNECTED) { Serial.print("."); delay(300); } Serial.println(); Serial.print("IP로 연결됨: "); Serial.println(WiFi.localIP()); Serial.println(); /\* API 키 할당 (필수) \*/ config.api\_key = API\_KEY; /\* RTDB URL 할당 (필수) \*/ config.database\_url = DATABASE\_URL; /\* 가입 \*/ if (Firebase.signUp(&config, &auth, "", "")) { Serial.println("로그인 성공 'ok'"); signupOK = true; } else { Serial.printf("%s\n", config.signer.signupError.message.c\_str()); } /\* 장기 실행 토큰 생성 작업을 위한 콜백 함수 할당 \*/ config.token\_status\_callback = tokenStatusCallback; // addons/TokenHelper.h 참조 Firebase.start(&config, &auth); Firebase.reconnectWiFi(true); // UART 통신 while (!Serial); // pinMode(BUTTON\_PIN, INPUT\_PULLUP); // attachInterrupt(digitalPinToInterrupt(BUTTON\_PIN), buttonInterrupt, FALLING); Serial2.begin(UART\_BAUDRATE, SERIAL\_8N1, 16 , 17); // RX: GPIO16, TX: GPIO17\}void loop() { // if (buttonPressed) { // Serial.printf("%s의 버튼을 눌렀습니다!\n", NODE\_ID); // Serial2.print(NODE\_ID); // Serial2.println("버튼 눌림"); // buttonPressed = false; // delay(10); // }if(!Firebase.ready()) {Serial.println("Firebase가 준비되지 않았습니다");}if(!signupOK) {Serial.println("로그인에 성공하지 못했습니다");} if (Firebase.ready() && signupOK & Serial2.available()) {// if (jsonData.readFrom(Serial2))// {// Serial.println("JSON 데이터 수신...");// jsonData.toString(Serial2, true);// Serial.println();// } Serial.println("수신 데이터."); String sendData = Serial2.readStringUntil('\n'); deserializeJson(jsonBuffer, sendData); // JSON 문자열을 JSON 객체로 역직렬화합니다. String chipID = jsonBuffer["chipID"].as(); int counter = jsonBuffer["counter"].as(); String message = jsonBuffer["message"].as(); Serial.printf("데이터 수신: ChipID: %s, Counter: %d, Message: %s\n", chipID.c\_str(), counter, message.c\_str());////// jsonData = jsonBuffer; if (Firebase.RTDB.setStringAsync(&fbdo, "test/string", sendData)) { Serial.println("DataBase에 데이터를 보냈습니다"); Serial.println("PATH: " + fbdo.dataPath()); Serial.println("TYPE: " + fbdo.dataType()); } }}