TFT ucg ST7735

TFT ucg ST7735

This page is to Setup and Config TFT ucg ST7735

Hardware and Software

Hardware

TFT ucg ST7735

Software

EXPLORER

Sanki Notes

      • Connect

      • TFT :: NODEMCU

        • PIN 1 - NC

        • PIN 2 - GND

        • PIN 3 - GND

        • PIN 4 - 3.3V

        • PIN 5 - GND

        • PIN 6 - RST : D0

        • PIN 7 - RS : D1

        • PIN 8 - SDA : D7

        • PIN 9 - SCL : D5

        • PIN 10 - 3.3V

        • PIN 11 - 3.3V

        • PIN 12 - CS : D8

        • PIN 13 - GND

        • PIN 14 - NC

Examples

This example is TFT Library for ucg Model and ST7735 (LUA Programming)

            1. -- WORK 20160920

            2. --

            3. -- TFT :: NODEMCU

            4. -- SCL -- D5

            5. -- SDA -- D7

            6. -- CS -- D8

            7. -- RS -- D1

            8. -- RST -- D0

            9. --

            10. local Nom_du_module = ...

            11. local M = {}

            12. _G[Nom_du_module] = M

            13. -- setup SPI and connect display

            14. function M.init_spi_display()

            15. -- Hardware SPI CLK = GPIO14

            16. -- Hardware SPI MOSI = GPIO13

            17. -- Hardware SPI MISO = GPIO12 (not used)

            18. -- Hardware SPI /CS = GPIO15 (not used)

            19. -- CS, D/C, and RES can be assigned freely to available GPIOs

            20. local cs = 8 -- GPIO15, pull-down 10k to GND

            21. local dc = 1 -- GPIO2

            22. local res = 0 -- GPIO16

            23. spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, 8, 8)

            24. -- we won't be using the HSPI /CS line, so disable it again

            25. gpio.mode(8, gpio.INPUT, gpio.PULLUP)

            26. -- initialize the matching driver for your display

            27. -- see app/include/ucg_config.h

            28. --disp = ucg.ili9341_18x240x320_hw_spi(cs, dc, res)

            29. disp = ucg.st7735_18x128x160_hw_spi(cs, dc, res)

            30. end

            31. init_spi_display()

            32. disp:begin(ucg.FONT_MODE_TRANSPARENT)

            33. disp:clearScreen()

            34. disp:setFont(ucg.font_ncenR12_tr);

            35. disp:setColor(255, 255, 255);

            36. disp:setColor(1, 255, 0,0);

            37. disp:setPrintPos(0, 25)

            38. disp:print("Hello World!")

            39. return M