Navigation

    LILYGO

    • Register
    • Login
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. Witchdoc
    3. Best
    W
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 8
    • Best 1
    • Groups 0

    Best posts made by Witchdoc

    • RE: corrupted text

      @teastain2 Thanks for the script. I found a solution to the blinking text. I have another display running on another ESP32 and I realized that it wasn't blinking. It is running a GPS program and displaying the time which always looks crisp and clean so I took a look at that script and realized it was using a different display library. TFT_eSPI. Took a bit of tinkering but I got a display that shows the temperature perfectly.```
      #include <TFT_eSPI.h> // Hardware-specific library
      #include <OneWire.h>
      #include <DallasTemperature.h>

      TFT_eSPI tft = TFT_eSPI();

      // GPIO where the DS18B20 is connected to
      const int oneWireBus = 32;

      float getTemperature(){
      // Setup a oneWire instance to communicate with any OneWire devices
      OneWire oneWire(oneWireBus);

      // Pass our oneWire reference to Dallas Temperature sensor
      DallasTemperature sensors(&oneWire);
      sensors.begin();
      //delay(dT) ;

      sensors.requestTemperatures();
      float temperatureC = sensors.getTempCByIndex(0);
      //float temperatureF = sensors.getTempFByIndex(0);
      return(temperatureC);
      }

      void setup() {
      Serial.begin(115200);
      //delay(dT) ;
      pinMode(TFT_BL, OUTPUT); // TTGO T-Display enable Backlight pin 4
      digitalWrite(TFT_BL, HIGH); // T-Display turn on Backlight
      tft.init(); // Initialize ST7789 240x135
      Serial.println(F("Initialized"));
      tft.fillScreen(TFT_BLACK);
      }

      void loop() {
      tft.setRotation(1);
      tft.setTextColor(TFT_GREENYELLOW,TFT_BLACK);
      tft.setCursor(0, 0);
      tft.print("Temperature: ");
      tft.setCursor(74, 50);
      tft.setTextSize(3);
      tft.print(getTemperature());
      }

      posted in Common problems
      W
      Witchdoc