Telegram Group & Telegram Channel
اسکریپت Lua برای ارتباط nodemcu و oled


sda = 2 — SDA Pin
scl = 1 — SCL Pin

s=0
m=0
h=0

function init_OLED(sda,scl) —Set up the u8glib lib
sla = 0x3C
i2c.setup(0, sda, scl, i2c.SLOW)
disp = u8g.ssd1306_128x64_i2c(sla)
disp:setFont(u8g.font_6x10)
disp:setFontRefHeightExtendedText()
disp:setDefaultForegroundColor()
disp:setFontPosTop()
—disp:setRot180() — Rotate Display if needed
end

function write_OLED() — Write Display
disp:firstPage()
repeat
disp:drawStr(50, 10, "Timer")
disp:drawStr(40, 30, string.format("%02d:%02d:%02d",h,m,s))
disp:drawStr(20, 50, "hello")
until disp:nextPage() == false
end

— Main Program
init_OLED(sda,scl)

tmr.alarm(0, 1000, 1, function() — Every second increment clock and display
s = s+1
if s==60 then
s=0
m=m + 1
end
if m==60 then
m=0
h=h + 1
end
if h==13 then
h=1
end
write_OLED()
end)



tg-me.com/micropython_iot/63
Create:
Last Update:

اسکریپت Lua برای ارتباط nodemcu و oled


sda = 2 — SDA Pin
scl = 1 — SCL Pin

s=0
m=0
h=0

function init_OLED(sda,scl) —Set up the u8glib lib
sla = 0x3C
i2c.setup(0, sda, scl, i2c.SLOW)
disp = u8g.ssd1306_128x64_i2c(sla)
disp:setFont(u8g.font_6x10)
disp:setFontRefHeightExtendedText()
disp:setDefaultForegroundColor()
disp:setFontPosTop()
—disp:setRot180() — Rotate Display if needed
end

function write_OLED() — Write Display
disp:firstPage()
repeat
disp:drawStr(50, 10, "Timer")
disp:drawStr(40, 30, string.format("%02d:%02d:%02d",h,m,s))
disp:drawStr(20, 50, "hello")
until disp:nextPage() == false
end

— Main Program
init_OLED(sda,scl)

tmr.alarm(0, 1000, 1, function() — Every second increment clock and display
s = s+1
if s==60 then
s=0
m=m + 1
end
if m==60 then
m=0
h=h + 1
end
if h==13 then
h=1
end
write_OLED()
end)

BY Micropython & IOT


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/micropython_iot/63

View MORE
Open in Telegram


Micropython & IOT Telegram | DID YOU KNOW?

Date: |

Importantly, that investor viewpoint is not new. It cycles in when conditions are right (and vice versa). It also brings the ineffective warnings of an overpriced market with it.Looking toward a good 2022 stock market, there is no apparent reason to expect these issues to change.

What is Telegram?

Telegram’s stand out feature is its encryption scheme that keeps messages and media secure in transit. The scheme is known as MTProto and is based on 256-bit AES encryption, RSA encryption, and Diffie-Hellman key exchange. The result of this complicated and technical-sounding jargon? A messaging service that claims to keep your data safe.Why do we say claims? When dealing with security, you always want to leave room for scrutiny, and a few cryptography experts have criticized the system. Overall, any level of encryption is better than none, but a level of discretion should always be observed with any online connected system, even Telegram.

Micropython & IOT from ru


Telegram Micropython & IOT
FROM USA