Skip to content

Commit b238efe

Browse files
committed
add ssd1306.py unittest.
1 parent d51b297 commit b238efe

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

07.sensors/ssd1306.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,20 @@ def poweron(self):
166166
self.res.low()
167167
time.sleep_ms(10)
168168
self.res.high()
169+
170+
def unit_test():
171+
import machine
172+
from ssd1306 import SSD1306_I2C
173+
174+
WIDTH = const(128)
175+
HEIGHT = const(64)
176+
sda_pin = machine.Pin(21)
177+
scl_pin = machine.Pin(22)
178+
179+
i2c = machine.I2C(scl=scl_pin, sda=sda_pin)
180+
181+
print(i2c.scan())
182+
183+
ssd = SSD1306_I2C(WIDTH, HEIGHT, i2c)
184+
ssd.fill(1)
185+
ssd.show()

0 commit comments

Comments
 (0)