RP2 + adafruit ILI9341

Hi
I need help to get started please.

I have built the firmware as follows: https://github.com/lvgl/lv_micropython

I don’t understand the documentation because when I copy the basic example

from ili9XXX import ili9341

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'ili9XXX'

I certainly missed something

The only code I can get to work is

import time
from machine import SPI, Pin
import ili9xxx
import lvgl as lv
import sys
lv.init()

spi = SPI(
    0,
    baudrate=24_000_000,
    sck=Pin(18),
    mosi=Pin(19),
    miso=Pin(16),
)
drv = ili9xxx.Ili9341(spi=spi, cs=17, dc=15, rst=14)

scr = lv.obj()
btn = lv.btn(scr)
btn.set_style_bg_color(lv.color_hex(0xFF0000), lv.PART.MAIN | lv.STATE.DEFAULT)
scr.set_style_bg_color(lv.color_hex(0x000000), lv.PART.MAIN | lv.STATE.DEFAULT)
label = lv.label(btn)
label.set_text("Hello World!")
btn.set_style_width(120, lv.PART.MAIN | lv.STATE.DEFAULT)
btn.set_style_height(35, lv.PART.MAIN | lv.STATE.DEFAULT)
bh = 18
bw = 60
by = 160 - bh
bx = 240 - bw
btn.set_x(bx)
btn.set_y(by)
lv.scr_load(scr)

start_time = time.ticks_ms()
while True:
    end_time = time.ticks_ms()
    diff = time.ticks_diff(end_time, start_time)
    if diff >= 1:
        start_time = end_time
        lv.tick_inc(diff)
        lv.task_handler()

but I had to copy it to my flash =>

ili9xxx.py
st77xx.py
lv_utils.py

I’d like to understand what I’ve missed and have a very simple example to start with

Thanks in advance

Typo:
In your basic example (that does not work) you import:

from ili9XXX import ili9341

Notice you wrote ili9XXX with three uppercase “X” and “ili9341” all lowercase.

But in your working code you import:

import ili9xxx
(...)
drv = ili9xxx.Ili9341(...)

See the difference ? uppercase/lowercase ?

What helps, is to check the online help ! On your micropython board you can type help(‘ili9xxx’) and verify what methods the module has.

Thank you !

this is the example of the readme

  • My question was: is it normal to have to manually copy into the flash: “ili9xxx.py”, “lv_utils.py” etc.?

  • are these modules not integrated?

this is a code of @amirgon

import lvgl as lv
import ili9341
disp = ili9341.ili9341(rot=0x20, width=320, height=240)

b = lv.btn(lv.scr_act())
l = lv.label(b)
l.set_text("Hello World!")

I’d like to start as simply !

Thank again for your support