So, trying to put the text from sensors on the tft screen of ESP32 reverse tft. It shows me the part of the.
#include <Arduino.h>
#include <Adafruit_AHTX0.h>
#include <SPI.h>
#include <Adafruit_NeoPixel.h>
#include <Adafruit_ST7789.h>
#include <Adafruit_BMP280.h>
#include <Adafruit_GFX.h>
Adafruit_BMP280 bmp;
Adafruit_AHTX0 aht;
Adafruit_ST7789 tftscreen = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
void setup() {
pinMode(13, OUTPUT);
pinMode(TFT_BACKLITE, OUTPUT);
pinMode(TFT_I2C_POWER, OUTPUT);
digitalWrite(TFT_BACKLITE, HIGH);
digitalWrite(TFT_I2C_POWER, HIGH);
delay(10);
tftscreen.init(135,240);
tftscreen.setRotation(3);
tftscreen.fillScreen(ST77XX_BLACK);
Serial.begin(115200);
while (!Serial) {
delay(10);
}
if (!bmp.begin()) {
Serial.println("Could not find BMP280? Check wiring");
while (1) delay(10);
}
bmp.setSampling(Adafruit_BMP280::MODE_FORCED);
if (! aht.begin()) {
Serial.println("Could not find AHT? Check wiring");
while (1) delay(10);
}
Serial.println("AHT10 or AHT20 found");
}
void loop() {
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);
Serial.print("Temperature: "); Serial.print(temp.temperature); Serial.println(" degrees C");
Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println("% rH");
delay(500);
if (bmp.takeForcedMeasurement()) {
Serial.print(F("Pressure = "));
Serial.print(bmp.readPressure());
Serial.println(" Pa");
Serial.println();
delay(2000);
} else {
Serial.println("Forced measurement failed!");
}
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
tftscreen.setTextColor(ST77XX_WHITE);
tftscreen.setCursor(0, 0);
tftscreen.setTextSize(2.35);
tftscreen.println("Temperature: " + String(temp.temperature) + " C");
tftscreen.println("Humidity: " + String(humidity.relative_humidity) + " % rH");
tftscreen.println("Pressure: " + String(bmp.readPressure()) + " Pa");
delay(2000);
}
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:adafruit_feather_esp32s3_reversetft]
platform = espressif32
board = adafruit_feather_esp32s3_reversetft
framework = arduino
lib_deps =
adafruit/Adafruit AHTX0@^2.0.5
bodmer/TFT_eSPI@^2.5.43
adafruit/Adafruit NeoPixel@^1.13.0
adafruit/Adafruit ST7735 and ST7789 Library@^1.11.0
adafruit/Adafruit BMP280 Library@^2.6.8
build_flags =
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1
monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0
I thing the problem in code. I would be really happy if someone can help me