1.配置
2.lua快速入门
3.esp8266/esp32
1.配置
物联网 app:https://www.bilibili.com/video/BV1HH4y1o7EN?p=16&vd_source=16fe21959b32113e989287117626e863
云平台 手机app:ThingsCloud
esp8266 wifi at烧录:https://www.bilibili.com/video/BV1Mx4y1P72o/?spm_id_from=333.337.search-card.all.click&vd_source=16fe21959b32113e989287117626e863
快速入门:
esp8266 arduino
网址;https://arduino-esp8266.readthedocs.io/en/latest/
https://www.bilibili.com/video/BV1vf4y1L7Rb/?spm_id_from=333.337.search-card.all.click&vd_source=16fe21959b32113e989287117626e863
https://www.yuque.com/welinklab/arduino/7d4f6fbbf8efce472b0a3c359a8e7ac9
lua移植stm32:
https://www.cnblogs.com/tiandaowang/p/17821699.html#3%E7%A7%BB%E6%A4%8Dlua
https://blog.csdn.net/weixin_46158019/article/details/131238467
1.https://blog.csdn.net/qq_43415863/article/details/114176094
2.gitee搜索 nodemculua
2.lua快速入门
print("hello world")
变量
a = 1
b = 2
local b = 1//局部变量
nil //没有声明的变量
print(c)//c = nil
a,b = 1,2//多变量赋值
b = 2e10 //20000000000
+ - ^ << >>
a = "hello world"//双引号
c = [[dklkfjdjkfdf]]//随意字符
a.b//字符串连接
c = tostring(10)//转换成字符串"10"
no = tonumber("10")//转换成数值10
print(#n)//获取字符串n长度
funtion add(a,b)
return a,b
end
add(1,2)//函数
table:
数字下表
a = {
1,"a",function() end}
print(a[1])//下表从1开始
a[5] = 1
print(#a)//获取长度
table.insert(a,"b")//数组末尾插入
table.insert(a,2,"b")//插入第二个位置
table.remove(a,2)//删除第二个元素 并且删除的元素返回
字符串下表
a = {
a=1,
b = "iu",
}
a["a"]或足a.a
a["a"] = "hello"//直接赋值
全局表
a = 1
_G
print(_G["a"])
真假
true/false
0是真
nil是假
and or not
print(b > 10 and "yes" or "NO")//b大于10返回YES,否则返回NO
if 1 > 10 then
...
else if 1> 10 then
....
else
....
end
for i = 1,10,2 do//初值,结束值,步长
......
end
while n > 1 do
.......
end
s = string.char(0x30,0x31,0x32)//得到字符串"012"
value = string.byte(s,2)//取值s字符串的第2位 assII数值0x31
lua文件调用
require("b")//导入文件
a/b :a文件夹下b文件
require(a.b)
dofile("b.lua")//运行文件
dofile("a/b.lua")//运行文件
lua创建文件
https://www.runoob.com/lua/lua-file-io.html
json 第三方实现
https://gitee.com/lua_development/yxzhushou/tree/master/%E9%B1%BC%E5%8F%89%E5%8A%A9%E6%89%8BLua%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%93
3.esp8266/esp32
1.配置
https://www.bilibili.com/video/BV1J14y1P7Qj/?spm_id_from=333.337.search-card.all.click&vd_source=16fe21959b32113e989287117626e863
https://www.bilibili.com/video/BV1yt411F7P4?p=2&vd_source=16fe21959b32113e989287117626e863
手册:
https://nodemcu.readthedocs.io/en/release/
https://gitee.com/the_mermaid_is_in_love/RENYU_NodeMCULua?_from=gitee_search
https://gitee.com/the_mermaid_is_in_love/RENYU_NodeMCULua?_from=gitee_search
烧写固件 nodemcu pyflasher
1.nodeMCU
烧写程序
nodemcu-tool
lua
gpio
gpio.mode(0, gpio.OUTPUT)
gpio.read(0)
gpio.write(0,gpio.HIGH)//gpio.HIGH or gpio.LOW
wifi sta模式
//不保存flash
station_cfg={
}
station_cfg.ssid="NODE-AABBCC"
station_cfg.pwd="password"
station_cfg.save=false
wifi.sta.config(station_cfg)
wifi.setmode(wifi.wifi.SOFTAP)//ap模式
//保存flash
--connect to Access Point (DO save config to flash)
station_cfg={
}
station_cfg.ssid="NODE-AABBCC"
station_cfg.pwd="password"
station_cfg.save=true
wifi.sta.config(station_cfg)
wifi.setmode(wifi.STATION)
wifi.sta.connect()//连接
wifi.sta.getip()//获取IP
定时
timer = tmr.create