commit
This commit is contained in:
parent
9a82196fd1
commit
ff6be1c95b
2 changed files with 49 additions and 0 deletions
5
main.lua
5
main.lua
|
@ -73,3 +73,8 @@ dofile("neopixel.lua")
|
||||||
dofile("encoder.lua")
|
dofile("encoder.lua")
|
||||||
dofile("dht22.lua")
|
dofile("dht22.lua")
|
||||||
dofile("screen.lua")
|
dofile("screen.lua")
|
||||||
|
dofile("wifi.lua")
|
||||||
|
|
||||||
|
-- attache l'écran
|
||||||
|
attachscreen(18, 19, 0x3C)
|
||||||
|
console("Hello, world!")
|
||||||
|
|
44
wifi.lua
Normal file
44
wifi.lua
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
dofile("screen.lua")
|
||||||
|
|
||||||
|
function displaynets()
|
||||||
|
nets = net.wf.scan(true)
|
||||||
|
cls()
|
||||||
|
for i=0,#nets-1 do
|
||||||
|
console(nets[i].ssid.." "..nets[i].rssi)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function displayopennets()
|
||||||
|
nets = net.wf.scan(true)
|
||||||
|
cls()
|
||||||
|
for i=0,#nets-1 do
|
||||||
|
if nets[i].auth == net.wf.auth.OPEN then
|
||||||
|
console(nets[i].ssid.." "..nets[i].rssi)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function scanwifi()
|
||||||
|
while true do
|
||||||
|
nets = net.wf.scan(true)
|
||||||
|
cls()
|
||||||
|
for i=0,#nets-1 do
|
||||||
|
console(nets[i].ssid.." "..nets[i].rssi)
|
||||||
|
end
|
||||||
|
tmr.delayms(1000)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function neorssi()
|
||||||
|
neo = neopixel.attach(neopixel.WS2812B, pio.GPIO21, 8)
|
||||||
|
while true do
|
||||||
|
nets = net.wf.scan(true)
|
||||||
|
nb = (-nets[0].rssi) * 8 // 100
|
||||||
|
for i=0,nb-1 do
|
||||||
|
r, g, b = wheelRGB(i * 255 // 8)
|
||||||
|
neo:setPixel(i, r//10, g//10, b//10)
|
||||||
|
end
|
||||||
|
neo:update()
|
||||||
|
tmr.delayms(1000)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue