Unable to use SPI display. Help please.
Posted: Thu Dec 22, 2016 9:51 pm
Hi all
Recently I installed micropython on esp8266 nodemcu dev board 1.1. I connected it as follows.
VCC -> 3V3
GND -> GND
CS -> D0 (nodemcu) or (GPIO 16)
RESET -> 3V3
A0 -> D1(nodemcu) or (GPIO 5)
SDA -> D7(nodemcu) or (GPIO 13), actually this is MOSI
LED -> 3V3
SCK -> D5(nodemcu) or (GPIO 14)
>>> os.listdir('.')
['boot.py', 'abcd.txt', 'serv.py', 'webrepl_cfg.py', 'ssd1306.mpy', 'ssd1306.py', 'st7735.mpy', 'st7735.py', 'ili9341.mpy', 'ili9341.py']
I tried both the following:
import ili9341
from machine import Pin, SPI
spi = SPI(miso=Pin(12), mosi=Pin(13, Pin.OUT), sck=Pin(14, Pin.OUT))
display = ili9341.ILI9341(spi, cs=Pin(0), dc=Pin(5), rst=Pin(4))
display.fill(ili9341.color565(0xff, 0x11, 0x22))
display.pixel(120, 160, 0)
from machine import Pin, SPI
import st7735
spi = SPI(miso=Pin(12), mosi=Pin(13, Pin.OUT), sck=Pin(14, Pin.OUT))
display = st7735.ST7735(128, 128, spi, Pin(2), Pin(4), Pin(5))
display.fill(0x7521)
display.pixel(64, 64, 0)
Neither of the things show up any display. Both of them do light up the screen. When fill is running or when I use display.pixel in a loop or when I run display.text() it does flicker. However nothing shows up on screen.
Any ideas what my folly is
Thanks
Recently I installed micropython on esp8266 nodemcu dev board 1.1. I connected it as follows.
VCC -> 3V3
GND -> GND
CS -> D0 (nodemcu) or (GPIO 16)
RESET -> 3V3
A0 -> D1(nodemcu) or (GPIO 5)
SDA -> D7(nodemcu) or (GPIO 13), actually this is MOSI
LED -> 3V3
SCK -> D5(nodemcu) or (GPIO 14)
>>> os.listdir('.')
['boot.py', 'abcd.txt', 'serv.py', 'webrepl_cfg.py', 'ssd1306.mpy', 'ssd1306.py', 'st7735.mpy', 'st7735.py', 'ili9341.mpy', 'ili9341.py']
I tried both the following:
import ili9341
from machine import Pin, SPI
spi = SPI(miso=Pin(12), mosi=Pin(13, Pin.OUT), sck=Pin(14, Pin.OUT))
display = ili9341.ILI9341(spi, cs=Pin(0), dc=Pin(5), rst=Pin(4))
display.fill(ili9341.color565(0xff, 0x11, 0x22))
display.pixel(120, 160, 0)
from machine import Pin, SPI
import st7735
spi = SPI(miso=Pin(12), mosi=Pin(13, Pin.OUT), sck=Pin(14, Pin.OUT))
display = st7735.ST7735(128, 128, spi, Pin(2), Pin(4), Pin(5))
display.fill(0x7521)
display.pixel(64, 64, 0)
Neither of the things show up any display. Both of them do light up the screen. When fill is running or when I use display.pixel in a loop or when I run display.text() it does flicker. However nothing shows up on screen.
Any ideas what my folly is
Thanks