-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMyOLED.lua
More file actions
31 lines (28 loc) · 743 Bytes
/
Copy pathMyOLED.lua
File metadata and controls
31 lines (28 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
-- setup I2c and connect display
function init_i2c_display()
-- SDA and SCL can be assigned freely to available GPIOs
local sda = 5 -- GPIO14
local scl = 6 -- GPIO12
local sla = 0x3c
i2c.setup(0, sda, scl, i2c.SLOW)
--disp = u8g.u8g_dev_sh1106_128x64(sla)
disp = u8g.ssd1306_128x64_i2c(sla)
end
function prepare()
disp:setFont(u8g.font_6x10)
disp:setFontRefHeightExtendedText()
disp:setDefaultForegroundColor()
disp:setFontPosTop()
end
function draw()
--disp:setFont(u8g.font_unifont)
--disp:setFont(u8g.font_6x10)
disp:drawStr(5,5,"temp: " )
end
init_i2c_display()
prepare()
-- picture loop
disp:firstPage()
repeat
draw()
until( disp:nextPage()==false )