I am trying do draw a rectangle on my MSP2807 display using the Raspberry Pi Pico. I am having problems with the "display" command setting up the MSP2807. When program gets down to the display command, which uses both ili9341 and ILI9341, I get the following error message:
Traceback (most recent call last):
File "<stdin>", line 16, in <module>
AttributeError: 'module' object has no attribute 'ILI9341' Line 16 is the display command
# Draw Rectangle
from machine import Pin, SPI
import ili9341
import time
# --- Configuration ---
TFT_WIDTH = 320
TFT_HEIGHT = 240
# --- SPI Setup ---
spi = SPI(0, baudrate=40000000, polarity=0, phase=0, sck=Pin(18), mosi=Pin(19))
# Pins: CS=GP17, DC=GP15, RST=GP16
display = ili9341.ILI9341(spi, cs=Pin(17), dc=Pin(15), rst=Pin(16), w=TFT_WIDTH, h=TFT_HEIGHT)
Rest of code follows below
I have ili9341.py installed within the Pico file set. Is there another file, ILI9341 different from ili9341 that I should be using?
1. What is going on here?
2. What must I do to correct this problem?
Traceback (most recent call last):
File "<stdin>", line 16, in <module>
AttributeError: 'module' object has no attribute 'ILI9341' Line 16 is the display command
# Draw Rectangle
from machine import Pin, SPI
import ili9341
import time
# --- Configuration ---
TFT_WIDTH = 320
TFT_HEIGHT = 240
# --- SPI Setup ---
spi = SPI(0, baudrate=40000000, polarity=0, phase=0, sck=Pin(18), mosi=Pin(19))
# Pins: CS=GP17, DC=GP15, RST=GP16
display = ili9341.ILI9341(spi, cs=Pin(17), dc=Pin(15), rst=Pin(16), w=TFT_WIDTH, h=TFT_HEIGHT)
Rest of code follows below
I have ili9341.py installed within the Pico file set. Is there another file, ILI9341 different from ili9341 that I should be using?
1. What is going on here?
2. What must I do to correct this problem?
Statistics: Posted by grenken — Mon Mar 02, 2026 8:34 pm — Replies 0 — Views 28