Forwarded from C & micro & fpga
Forwarded from C & micro & fpga
Armstrong_Subero_auth_Programming.pdf
5.4 MB
Forwarded from C & micro & fpga
آموزش اتصال آردوینو به تلگرام.pdf
21.9 MB
آموزش اتصال آردوینو به تلگرام و کنترل رله👌
⚡️این جزوه در 60 صفحه تهیه شده است و دارای تصاویر از جزییات کار می باشد⚡️
@c_micro
⚡️این جزوه در 60 صفحه تهیه شده است و دارای تصاویر از جزییات کار می باشد⚡️
@c_micro
اسکریپت 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)
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)
Forwarded from C & micro & fpga
اسکریپت Lua برای سنسور PIR
PIRpin = 1
LEDpin = 4
gpio.mode(PIRpin, gpio.INPUT)
gpio.mode(LEDpin, gpio.OUTPUT)
while true do
gpio.write(LEDpin, gpio.read(PIRpin))
tmr.delay(10000)
end
🆔 @micropython_iot
PIRpin = 1
LEDpin = 4
gpio.mode(PIRpin, gpio.INPUT)
gpio.mode(LEDpin, gpio.OUTPUT)
while true do
gpio.write(LEDpin, gpio.read(PIRpin))
tmr.delay(10000)
end
🆔 @micropython_iot
Forwarded from 🐍 Python & Raspberry 🐍 (F.Naserizadeh)
Forwarded from Micropython & IOT (F.Naserizadeh)
micropython.pdf
1.2 MB
❇️ اسکریپت Lua سمت فرستنده
count = 0
-- set uart0 with 1200 baud rate, 8 databits, no pariy, 1 stop bit with echo
uart.setup(0,1200,8,0,1,1)
while true do -- continuous send count
print(count)
count = count + 1
tmr.delay(1000000)
end
❇️ اسکریپت Lua سمت گیرنده
-- set uart0 with 1200 baud rate, 8 databits, no pariy, 1 stop bit with echo
uart.setup(0,1200,8,0,1,1)
--print received data
uart.on("data", "\n", function(data) print("receive from uart:", data) end, 0)
🔰 @micropython_iot
count = 0
-- set uart0 with 1200 baud rate, 8 databits, no pariy, 1 stop bit with echo
uart.setup(0,1200,8,0,1,1)
while true do -- continuous send count
print(count)
count = count + 1
tmr.delay(1000000)
end
❇️ اسکریپت Lua سمت گیرنده
-- set uart0 with 1200 baud rate, 8 databits, no pariy, 1 stop bit with echo
uart.setup(0,1200,8,0,1,1)
--print received data
uart.on("data", "\n", function(data) print("receive from uart:", data) end, 0)
🔰 @micropython_iot