1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

M5StackのLCDをMicroPythonから使ってみる(低速)

Posted at

#免責
この記事に従って発生した如何なる損害も筆者は負うことができません。ご免なさい。

目的

M5Stack Basicを買ったので、Flash Download Tools本家のMicroPythonを入れて液晶を使ってみます。pythonコードなので非常に低速です。

ライブラリの用意

WebREPLなどを使ってili9342c.pyをM5Stackに転送してください。
MicroPythonの開発にはuPydevが便利なので、こちらも見てやってください。

サンプルコード

ili9342c.pyが使えるようになったら、以下のように動かせます。

MicroPython
>>> import ili9342c
>>> color565 = ili9342c.color565
>>> from machine import Pin, SPI
>>> spi = SPI(miso=Pin(19), mosi=Pin(23, Pin.OUT), sck=Pin(18, Pin.OUT))
>>> display = ili9342c.ILI934X(spi, cs=Pin(14), dc=Pin(27), rst=Pin(33), bl=Pin(32))
>>> display.fill(color565(0x00, 0x00, 0x00))
>>> 
>>> display.fill_rectangle(150, 150, 40, 10, color565(0x00, 0xff, 0x00))
>>> display.fill_rectangle(10, 10, 20, 60, color565(0x00, 0x00, 0xff))
>>> display.fill_rectangle(200, 70, 50, 50, color565(0xff, 0x00, 0x00))
>>> display.text('Hello,World!', 16, 128)
>>> display.scroll(8)
>>> display.scroll(8)
>>> 
>>> import sys
>>> del sys.modules['ili9342c']
>>> del sys
>>> 

参考

みなさまのおかげです。

M5Stack CORE – BASIC Version (ILI9341 BL(backlight))

Flash Download Tools (ESP8266 & ESP32 & ESP32-S2)

Firmware with ESP-IDF v4.x (esp32-idf4-20191220-v1.12.bin)

micropython-ili9341

ILI9340/ILI9341 TFT Display

ILI9342C Datasheet

1
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?