Professional Documents
Culture Documents
Comm
Comm
sudo vncserver:1
www.realvnc.com
-- Config
local pin = 4 --> GPIO2
local value = gpio.LOW
local duration = 4000 --> 1 second
gpio.write(pin, value)
end
-- Create an interval
tmr.alarm(0, duration, 1, toggleLED)
station_cfg={}
station_cfg.ssid="UPC7258062"
station_cfg.pwd="DNRYDEJM"
wifi.sta.config(station_cfg)
print(wifi.sta.getip())
///
wifi.sta.config("UPC7258062", "DNRYDEJM")
sta_if.connect('UPC7258062', 'DNRYDEJM')
print(request)
return request
end
-- When using send_sms: the "from" number HAS to be your twilio number.
-- If you have a free twilio account the "to" number HAS to be your twilio verified
number.
local function send_sms(from,to,body)
local data = {
sid = TWILIO_ACCOUNT_SID,
token = TWILIO_TOKEN,
Body = string.gsub(body," ","+"),
From = from,
To = to
}
socket = net.createConnection(net.TCP,0)
socket:on("receive",display)
socket:connect(80,HOST)
socket:on("connection",function(sck)
if(ip==nil) then
print("Connecting...")
else
tmr.stop(0)
print("Connected to AP!")
print(ip)
-- send a text message with the text "Hello from your esp8266"
send_sms("15558889944","15559998845","Hello from your ESP8266")
end
end
tmr.alarm(0,7000,1,check_wifi)