Data Sheet

35
tmr.stop(1)
print("Connected!")
print("Client IP Address:",wifi.sta.getip())
cl=net.createConnection(net.TCP, 0)
cl:connect(80,"192.168.4.1")
tmr.alarm(2, 5000, 1, function()
if(wifi.sta.getip()==nil) then
wifi.sta.disconnect()
wifi.sta.config("test","12345678") -- connecting to server
wifi.sta.connect()
print("Looking for a connection")
tmr.start(1)
end
cl:send("Hello World!")
cl:send(i)
i=i+1
end)
else
print("Connecting...")
end
end)
We can according the print information display in the Lualoader debug window to judge the
two NodeMCU Whether have established a connection. If the AP mode NodeMCU receive a
“Hello World!” from the “STA mode” NodeMCU that means the communication establish
successful.
Lesson18: DHT11 Temperature Display System
In this lesson you will know how to use the DHT11 temperature sensor, and display it on the
OLED, It is easy to make us always know the current temperature. And we will use two ESP8266
NodeMCU for the sake of knowing the temperature of the DHT11 that placed anywhere.
Material:
Crowtail- ESP8266 NodeMCU x 2
Crowtail- OLED x 1
Crowtail- Temperature & humidity Sensor x 1
Hardware Connection