Пример #1
0
TFT_CS_PIN = const(13)
TFT_RST_PIN = const(14)
TFT_DC_PIN = const(15)

spi = SPI(1,
          baudrate=40000000,
          miso=Pin(TFT_MISO_PIN),
          mosi=Pin(TFT_MOSI_PIN),
          sck=Pin(TFT_CLK_PIN))
print(spi)

display = ILI9341(spi,
                  cs=Pin(TFT_CS_PIN),
                  dc=Pin(TFT_DC_PIN),
                  rst=Pin(TFT_RST_PIN),
                  w=SCR_WIDTH,
                  h=SCR_HEIGHT,
                  r=SCR_ROT)

display.erase()
display.set_pos(0, 0)

#demo freesans48
display.set_font(freesans48)
display.erase()
display.set_pos(0, 0)
display.print("freesans48")
display.print("1234567890")
utime.sleep(1)
Пример #2
0
TFT_LED_PIN = const(32)
TFT_DC_PIN = const(27)
TFT_CS_PIN = const(14)
TFT_MOSI_PIN = const(23)
TFT_CLK_PIN = const(18)
TFT_RST_PIN = const(33)
TFT_MISO_PIN = const(19)

i2c = I2C(scl=Pin(22), sda=Pin(21), freq=400000)
dht = DHT12(i2c)
bmp = BMP280(i2c)

power = Pin(TFT_LED_PIN, Pin.OUT)
power.value(1)
spi = SPI(2, baudrate=10000000, miso=Pin(TFT_MISO_PIN), mosi=Pin(TFT_MOSI_PIN), sck=Pin(TFT_CLK_PIN))
display = ILI9341(spi, cs=Pin(TFT_CS_PIN), dc=Pin(TFT_DC_PIN), rst=Pin(TFT_RST_PIN))

display.erase()

while True:
    dht.measure()
    sleep(0.5)
    pres = bmp.get()
#   print("Temperature: ",dht.temperature(),"°C")
    txt_temp = "Temperature: " + str(dht.temperature()) + " C "
#   print("Humidity: ",dht.humidity(),"%")
    txt_hum = "Humidity: " + str(dht.humidity()) + " % "
#   print("Temperature BMP280: ", pres[0],"°C")
#   print("Air Pressure: ", pres[1],"Pa")
    txt_pres = "Air Pressure: " + str(pres[1]) + " Pa "
#   print()
from ili934xnew import ILI9341, color565
from machine import Pin, SPI
import tt14

text = 'F'
spi = SPI(2, baudrate=20000000, miso=Pin(19), mosi=Pin(23), sck=Pin(18))
display = ILI9341(spi, cs=Pin(2), dc=Pin(27), rst=Pin(33), w=320, h=240, r=0)
display.erase()
display.set_font(tt14)
display.set_pos(0, 0)
display.print(text)
display.set_pos(0, 20)
display.print(text)
display.set_pos(40, 20)
display.print(text)
Пример #4
0
print(text)
print("fonts available:")
for f in fonts:
    print(f.__name__)

spi = SPI(1,
          baudrate=20000000,
          miso=TFT_MISO_PIN,
          mosi=TFT_MOSI_PIN,
          sck=TFT_CLK_PIN)
print(spi)

display = ILI9341(spi,
                  cs=TFT_CS_PIN,
                  dc=TFT_DC_PIN,
                  rst=TFT_RST_PIN,
                  w=SCR_WIDTH,
                  h=SCR_HEIGHT,
                  r=SCR_ROT)

print(dir(display))
display.reset()
display.erase()
display.set_pos(0, 0)

for ff in fonts:
    display.set_font(ff)
    display.print(text)

display.set_font(tt24)
display.set_color(color565(255, 255, 0), color565(150, 150, 150))
Пример #5
0
# display - official
from ili934xnew import ILI9341, color565
from machine import SPI, Pin
import mcp

spi = SPI(
    2,
    baudrate=40000000,
    miso=Pin(19),
    mosi=Pin(23),
    sck=Pin(18))
display = ILI9341(spi,
    cs=Pin(0),
    dc=Pin(15),
    rst=Pin(5))

I2C_SCL = 27
I2C_SDA = 32

BUTTON_LEFT = 5
BUTTON_RIGHT = 6
BUTTON_UP = 7
BUTTON_DOWN = 4

PIN_LEFT = 9 #f****d
PIN_RIGHT = 10 #gucci
PIN_UP = 8 #gucci
PIN_DOWN = 11 #gucci

DIR_STOPPED = 0
DIR_LEFT = 1
Пример #6
0
from ili934xnew import ILI9341, color565
from machine import Pin, SPI, RTC
import tt14
import tt24

spi = SPI(1, baudrate=19000000, miso=Pin(12), mosi=Pin(13), sck=Pin(14))
display = ILI9341(spi, cs=15, dc=32, rst=25, w=320, h=240, r=2)
rtc = RTC()


def text_to_list(file):
    with open(file, "r") as f:
        data = [line for line in f.readlines()]
        f.close()
    data_F = []
    for line in data:
        line = line[:-2]
        data_line = []
        for char in line:
            if char == '0':
                data_line.append(0)
            else:
                data_line.append(1)
        data_F.append(data_line)
    data = []
    return (data_F)
    data_F = []


def Screen_init():
    display.erase()
Пример #7
0
led = Pin(25, Pin.OUT)
adc = ADC(28)

power = Pin(15, Pin.OUT)
power.value(0)

spi = SPI(0,
          baudrate=40000000,
          polarity=0,
          phase=0,
          sck=Pin(18),
          mosi=Pin(19),
          miso=Pin(16))

tft = ILI9341(spi, cs=Pin(12), rst=Pin(13), dc=Pin(14), w=320, h=240, r=3)


def fast_hline(x, y, width, color):
    tft.fill_rectangle(x, y, width, 1, color)


def fast_vline(x, y, height, color):
    tft.fill_rectangle(x, y, 1, height, color)


def draw_circle(xpos0, ypos0, rad, col=color565(255, 255, 255)):
    x = rad - 1
    y = 0
    dx = 1
    dy = 1
def init_tft():
    spi = SPI(1,baudrate=40000000,miso=Pin(TFT_MISO_PIN),mosi=Pin(TFT_MOSI_PIN),sck=Pin(TFT_CLK_PIN))
    display = ILI9341(spi,cs=Pin(TFT_CS_PIN),dc=Pin(TFT_DC_PIN),rst=Pin(TFT_RST_PIN),w=WIDTH,h=HEIGHT,r=ROTATION)
    display.erase()
    return display
Пример #9
0
import tt14
import tt24
import tt32

fonts = [glcdfont, tt14, tt24, tt32]

text = 'Now is the time for all good men to come to the aid of the party.'

power = Pin(m5stack.TFT_LED_PIN, Pin.OUT)
power.value(1)

spi = SPI(2,
          baudrate=40000000,
          miso=Pin(m5stack.TFT_MISO_PIN),
          mosi=Pin(m5stack.TFT_MOSI_PIN),
          sck=Pin(m5stack.TFT_CLK_PIN))

display = ILI9341(spi,
                  cs=Pin(m5stack.TFT_CS_PIN),
                  dc=Pin(m5stack.TFT_DC_PIN),
                  rst=Pin(m5stack.TFT_RST_PIN),
                  w=320,
                  h=240,
                  r=3)

display.erase()
display.set_pos(0, 0)
for ff in fonts:
    display.set_font(ff)
    display.print(text)