Skip to content

Commit 52cee56

Browse files
asterix24danieledapo
authored andcommitted
ports: esp32: modules: add simple function to test hw
1 parent 04275a7 commit 52cee56

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

ports/esp32/modules/hw_tests.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import machine
2+
from hw_cfg import *
3+
import time
4+
5+
def display_test():
6+
import sh1106
7+
spi = machine.SPI(baudrate = 100000, sck=sck_pin, mosi=mosi_pin,
8+
miso=miso_pin)
9+
display = sh1106.SH1106_SPI(128, 64, spi, dc_pin, res_pin, cs_pin)
10+
display.sleep(False)
11+
display.fill(1)
12+
display.show()
13+
time.sleep(1)
14+
15+
for i in range(3):
16+
display.fill(0)
17+
display.show()
18+
time.sleep(0.4)
19+
display.text("Otto Test!", 2, 1)
20+
display.show()
21+
time.sleep(0.4)
22+
23+
display.fill(0)
24+
display.show()
25+
time.sleep(1)
26+
27+
for i in range(0,255, 10):
28+
display.fill(0)
29+
display.text("%s" % i, 2, 1)
30+
display.fill_rect(40, 10, 50, 40, 1)
31+
display.contrast(i)
32+
display.show()
33+
time.sleep(0.3)
34+
35+
display.fill(0)
36+
display.text("Fine", 2, 1)
37+
display.show()
38+
time.sleep(1)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy