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)
-- WORK 20160920
--
-- TFT :: NODEMCU
-- SCL -- D5
-- SDA -- D7
-- CS -- D8
-- RS -- D1
-- RST -- D0
--
local Nom_du_module = ...
local M = {}
_G[Nom_du_module] = M
-- setup SPI and connect display
function M.init_spi_display()
-- Hardware SPI CLK = GPIO14
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used)
-- Hardware SPI /CS = GPIO15 (not used)
-- CS, D/C, and RES can be assigned freely to available GPIOs
local cs = 8 -- GPIO15, pull-down 10k to GND
local dc = 1 -- GPIO2
local res = 0 -- GPIO16
spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, 8, 8)
-- we won't be using the HSPI /CS line, so disable it again
gpio.mode(8, gpio.INPUT, gpio.PULLUP)
-- initialize the matching driver for your display
-- see app/include/ucg_config.h
--disp = ucg.ili9341_18x240x320_hw_spi(cs, dc, res)
disp = ucg.st7735_18x128x160_hw_spi(cs, dc, res)
end
init_spi_display()
disp:begin(ucg.FONT_MODE_TRANSPARENT)
disp:clearScreen()
disp:setFont(ucg.font_ncenR12_tr);
disp:setColor(255, 255, 255);
disp:setColor(1, 255, 0,0);
disp:setPrintPos(0, 25)
disp:print("Hello World!")
return M