mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
add LCD example
This commit is contained in:
parent
6d3762cab6
commit
48ecaa7a8b
47
examples/LCD/main.py
Normal file
47
examples/LCD/main.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
from PikaObj import *
|
||||||
|
import PikaStdLib
|
||||||
|
import PikaPiZero
|
||||||
|
import STM32G0
|
||||||
|
|
||||||
|
lcd = PikaPiZero.LCD()
|
||||||
|
lcd.init()
|
||||||
|
lcd.clear('white')
|
||||||
|
mem = PikaStdLib.MemChecker()
|
||||||
|
key = PikaPiZero.KEY()
|
||||||
|
key.init()
|
||||||
|
time = STM32G0.Time()
|
||||||
|
h = 10
|
||||||
|
w = 10
|
||||||
|
x = 10
|
||||||
|
y = 10
|
||||||
|
x_last = x
|
||||||
|
y_last = y
|
||||||
|
is_update = 0
|
||||||
|
print('mem used max:')
|
||||||
|
mem.max()
|
||||||
|
lcd.fill(x, y, w, h, 'blue')
|
||||||
|
while True:
|
||||||
|
if key.get() == 0:
|
||||||
|
is_update = 1
|
||||||
|
x_last = x
|
||||||
|
y_last = y
|
||||||
|
x = x + 5
|
||||||
|
if key.get() == 1:
|
||||||
|
is_update = 1
|
||||||
|
x_last = x
|
||||||
|
y_last = y
|
||||||
|
y = y - 5
|
||||||
|
if key.get() == 2:
|
||||||
|
is_update = 1
|
||||||
|
x_last = x
|
||||||
|
y_last = y
|
||||||
|
y = y + 5
|
||||||
|
if key.get() == 3:
|
||||||
|
is_update = 1
|
||||||
|
x_last = x
|
||||||
|
y_last = y
|
||||||
|
x = x - 5
|
||||||
|
if is_update:
|
||||||
|
is_update = 0
|
||||||
|
lcd.fill(x_last, y_last, w, h, 'white')
|
||||||
|
lcd.fill(x, y, w, h, 'blue')
|
6
examples/LCD/requestment.txt
Normal file
6
examples/LCD/requestment.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
pikascript-core==v1.2.3
|
||||||
|
PikaStdLib==v1.2.1
|
||||||
|
PikaStdDevice==v1.4.2
|
||||||
|
PikaPiZero==v1.1.2
|
||||||
|
STM32G030Booter==v1.2.4
|
||||||
|
STM32G0==v1.0.2
|
Loading…
x
Reference in New Issue
Block a user