Mn sửa lỗi khai báo giúp mình ko bt ạ ;(
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
void setup() {
Serial.begin(9600); // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
display.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64)
display.display();
delay(2000);
display.clearDisplay(); // Clear the buffer.
}
void loop() {
//CHECK THE SERIAL PORT FOR INCOMING MESSAGES
//THE ARDUINO APP SENDS A TEXT STRING THROUGH BLUETOOTH EVERY SECOND
//THE STRING SHOULD RESEMBLE THIS: date | time | phone | text \n
while(Serial.available() > 0){
//READ THE STRING TO THE FIRST "|" DIVIDER AND STORE AS A VARIABLE
String Date = Serial.readStringUntil('|');
Serial.read();
//STORE THE NEXT SECTION OF STRING AS A VARIABLE
String Time = Serial.readStringUntil('|');
Serial.read();
//STORE THE THIRD SECTION OF STRING AS A VARIABLE
String Phone = Serial.readStringUntil('|');
Serial.read();
//STORE THE FINAL SECTION AS A VARIABLE
String Text = Serial.readStringUntil('\n');
Serial.read();
}
if(Text == "Text" && Phone == "Phone")
{ display.println(Date);
display.display();
display.println(Time);
display.display();
display.clearDisplay();
}
if (Text != "Text" && Phone == "Phone"){
display.println(Text);
display.display();
delay(5000);
display.clearDisplay();
}
if (Text == "Text" && Phone != "Phone"){
display.println(Phone);
display.display();
delay(5000);
display.clearDisplay();
}
}