Connect WiFi LoRa 32 (v3) to TFT display via SPI?

Hi,

I’m trying to connect a Heltec ESP32 Wifi Lora (v3) to a 2.8" TFT SPI 240x320 v1.2 display.

I’m just looking for example code to make this work.

The example code for this board in the Arduino 2.0 IDE doesn’t compile.

The error message is below:

 In file included from C:\Users\MyName\AppData\Local\Arduino15\libraries\TFT\src/TFT.h:37,
                 from D:\All My Saves\Saves\Arduino_ESP32\Heltec_ESP32WifiV3_TFTDisplayText_v0\Heltec_ESP32WifiV3_TFTDisplayText_v0.ino:18:
C:\Users\MyName\AppData\Local\Arduino15\libraries\TFT\src/utility/Adafruit_ST7735.h:30:10: fatal error: avr/pgmspace.h: No such file or directory
 #include <avr/pgmspace.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: exit status 1

Details:

I am using Arduino IDE 2.0.4.

I already installed the Heltec board support via the device manager (v. 0.0.7), and I also have installed the ESP32 by Espressif Systems (2.0.7).

In the ArduinoIDE preferences:

  1. d:\All My Saves\Saves\Arduino_ESP32
    *** note that I also tried removing the spaces in the “All My Saves” folder and rebooting and then relaunching Arduino IDE, updating this setting, and recompiling. But I get the same error (just that it can’t find the d path now. ***

  2. I have manually added these board urls:
    https://dl.espressif.com/dl/package_esp32_index.json,https://github.com/HelTecAutomation/CubeCell-Arduino/releases/download/V1.4.0/package_CubeCell_index.json,https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/releases/download/0.0.7/package_heltec_esp32_index.json,https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json,https://www.pjrc.com/teensy/package_teensy_index.json

I’m trying to run the example code for TFT support from: File>Examples>“Examples for Heltec LoRa Wifi v32 (v3)/wireless shell(v3)/…”>Arduino>TFTDisplayText"

For your reference, the example code is below (note that I updated the pin numbers for Reset, CS, and DC):

/*
  Arduino TFT text example

  This example demonstrates how to draw text on the
  TFT with an Arduino. The Arduino reads the value
  of an analog sensor attached to pin A0, and writes
  the value to the LCD screen, updating every
  quarter second.

  This example code is in the public domain

  Created 15 April 2013 by Scott Fitzgerald

  http://www.arduino.cc/en/Tutorial/TFTDisplayText

 */

#include <TFT.h>  // Arduino LCD library
#include <SPI.h>

// pin definition for the Uno
#define cs   2
#define rst  3
#define dc   4


// pin definition for the Leonardo
// #define cs   7
// #define dc   0
// #define rst  1

// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);

// char array to print to the screen
char sensorPrintout[4];

void setup() {

  // Put this line at the beginning of every sketch that uses the GLCD:
  TFTscreen.begin();

  // clear the screen with a black background
  TFTscreen.background(0, 0, 0);

  // write the static text to the screen
  // set the font color to white
  TFTscreen.stroke(255, 255, 255);
  // set the font size
  TFTscreen.setTextSize(2);
  // write the text to the top left corner of the screen
  TFTscreen.text("Sensor Value :\n ", 0, 0);
  // ste the font size very large for the loop
  TFTscreen.setTextSize(5);
}

void loop() {

  // Read the value of the sensor on A0
  String sensorVal = String(analogRead(A0));

  // convert the reading to a char array
  sensorVal.toCharArray(sensorPrintout, 4);

  // set the font color
  TFTscreen.stroke(255, 255, 255);
  // print the sensor value
  TFTscreen.text(sensorPrintout, 0, 20);
  // wait for a moment
  delay(250);
  // erase the text you just wrote
  TFTscreen.stroke(0, 0, 0);
  TFTscreen.text(sensorPrintout, 0, 20);
}

ping…

Any tips on connecting to a TFT touch display?

Were you ever successful with this? Is there a way to have an external display connected to the Lora 32 V3? Either ST7735 or ILI9341?