HCScreen library, new functions and control with joystick

The new functions in the library are for reading out and displaying the contents of an SD card. The following new features have been added:

setDirectory (path, SDcs)

An attempt is made to mount the SD card in the reader and to read the directory for the specified path. A title bar is always displayed. If an error occurs, the title bar shows Error, otherwise the title bar shows the current path. The first entry is always ".." to go back one level or, for example, to go back to the main menu in the event of an error.

getTitle ()

This function returns the content of the title bar as a string. This is useful to get the current path.

setTextfile (path, filename)

The function tries to open the file with the specified file name in the specified path. If the function is successful, the first 100 lines of the text file are shown on the display. Lines that are longer than the displayable characters per line are automatically split. If the file contains characters in UTF8 format, they are automatically converted so that they are displayed correctly. With the functions selectNext () and selectPrevious the display window can be moved over the text.

Example sketch:

There are two different sketches in the library examples. ESP32_Control_Center (with rotary encoder) and ESP32_Control_CenterJoy with control via joystick. The pin assignment was chosen so that you can easily replace the rotary encoder module with the joystick module.

 

The library as well as the examples can be found under the last time

HCScreen library  on github.

DisplaysSpecials

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN