I'm playin' around with ILI9341 screen and trying to build simple environmental sensor battery powered so i wish to use sleep. Light sleep at first, later i'll work on deepsleep
Simplified code:
Code: Select all
from ili934x import ILI9341 # , color565
from machine import Pin, SPI, lightsleep
import config as LCDPin
power = Pin(LCDPin.LED_PIN, Pin.OUT)
power.value(1)
spi = SPI(
1,
baudrate=51200000,
miso=Pin(LCDPin.MISO_PIN),
mosi=Pin(LCDPin.MOSI_PIN),
sck=Pin(LCDPin.CLK_PIN))
display = ILI9341(
spi,
cs=Pin(LCDPin.CS_PIN),
dc=Pin(LCDPin.DC_PIN),
rst=Pin(LCDPin.RST_PIN),
w=320,
h=240,
r=1)
while True:
# do stuff
# display data on screen
# ---> lightsleep(10000) # sleep for 10 seconds
# screen is dead
Code: Select all
from micropython import const
LED_PIN = const(21)
DC_PIN = const(5)
CS_PIN = const(2)
RST_PIN = const(4)
CLK_PIN = const(14) # 18
MOSI_PIN = const(13) # 23
MISO_PIN = const(12) # 22
Version: MicroPython v1.12 on 2019-12-20; ESP32 module with ESP32 WROOM board