Dear Frenky, thanx for sharing Your "brainware"! Can You please explain what the lua code "function newdata(serialData)" should do and when or where will this func be called? I think, serial data coming from Ardu should be collected here?! Greetings from Germany, WolgaWibr
I have interfaced Arduino with ESP8266 wifi module and LCD. I want to send text from Webpage and it should get displayed on LCD. Can anyone please suggest me the arduino code and web code.
sir i m getting"ESP8266 serial sniffer:"on my ip address...first arduino transmits "HII"properly..as i can see it on com port...i do all the connections..uploading code to the second arduino then lua code on esp without any error..but i still dont getting data on webserver..give me a direction..thank you
if data=="encoder1count" then uart.on("data") print("Received from Arduino:", data) end srv=net.createServer(net.TCP) srv:listen(80,function(conn) conn:on("receive",function(conn,payload) --print(payload) -- for debugging only --generates HTML web site conn:send('HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nCache-Control: private, no-store\r\n\r\n\ \ '..encoder1count..'') conn:on("sent",function(conn) conn:close() end) end) end) i have connected one rotary encoder to the arduino...n then to to the esp...i m getting data arduino to esp and printing it in serial monitor bt i want it on webpage...as i send something stable value cnt=100 its showing on webpage when i connected encoder its printing on serial monitor bt not on webpage...i think continous data is being rejected by webpage...kindly give some suggestions...i almost reached thank you..;-)
There is a better way to upload mysite.html. Copy the code in notepad. Save it as mysite.html. Then use "Upload File" option in LuaLoader to upload it to ESP:
i have uploaded this file i think this is ok..showing"s2.html:1: only one tcp server allowed"......one question sir for uploading html file is it another way or same like lua?..:-(..i have paste it in editor then save it as "s2.html' then write same in blank box below "upload file"..is it right way to download html file??
i uploaded mysite.html code to the esp in lualoader when i did "dofie"it is showing error like "mysite.html:1: unexpected symbol near '<' "what is that exactly??
i have used another arduino as serial device...which will send "hii"serially...
void setup() { Serial.begin(9600); }
void loop() { Serial.print("HI!"); delay(1000); }
then i have connect 1) rx of first arduino to 11 pin of second arduino..and
2)tx of first arduino to 10 pin of second arduino
3)rx tx of second arduino to tx rx of esp respectively...
~first i programmed 1 st arduino with above program
then ~ second one with your serial code as you posted in comment
then ~ in esp firstly i set ssid and passward of my wifi then download your mysite.html code then init.lua code thats all i did it ...esp's blue light is being flickring but on obtained ip it doesn't show anything..plz help
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Dear Frenky, thanx for sharing Your "brainware"! Can You please explain what the lua code "function newdata(serialData)" should do and when or where will this func be called? I think, serial data coming from Ardu should be collected here?! Greetings from Germany, WolgaWibr
Are you sure? yes | no
I have interfaced Arduino with ESP8266 wifi module and LCD. I want to send text from Webpage and it should get displayed on LCD. Can anyone please suggest me the arduino code and web code.
Are you sure? yes | no
How i will connect esp8266 oled and arduino?, can u give us wiring map?
Are you sure? yes | no
sir please suggest me any other serial device or ic which has serial port ...:-)
Are you sure? yes | no
Are you sure? yes | no
okay sir ...:-)
Are you sure? yes | no
Try to understand what my code does. Because it works.
You code is totally different...
Are you sure? yes | no
what can i do now...?i m confused:-(
Are you sure? yes | no
Perhaps this will help? http://goo.gl/50yA6d
Are you sure? yes | no
error is like this:unprotected error in call to Lua API (init.lua:16:attempt to concatenate global 'encoder1count' (a nil value))
Are you sure? yes | no
hii sir ....code--
wifi.setmode(wifi.STATION)
wifi.sta.config("ELITE","rutujajoshi123%")
print(wifi.sta.getip())
if data=="encoder1count" then
uart.on("data")
print("Received from Arduino:", data)
end
srv=net.createServer(net.TCP) srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
--print(payload) -- for debugging only
--generates HTML web site
conn:send('HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nCache-Control: private, no-store\r\n\r\n\
\
'..encoder1count..'')
conn:on("sent",function(conn) conn:close() end)
end)
end)
i have connected one rotary encoder to the arduino...n then to to the esp...i m getting data arduino to esp and printing it in serial monitor bt i want it on webpage...as i send something stable value cnt=100 its showing on webpage when i connected encoder its printing on serial monitor bt not on webpage...i think continous data is being rejected by webpage...kindly give some suggestions...i almost reached thank you..;-)
Are you sure? yes | no
There is a better way to upload mysite.html. Copy the code in notepad. Save it as mysite.html. Then use "Upload File" option in LuaLoader to upload it to ESP:
Are you sure? yes | no
i have uploaded this file i think this is ok..showing"s2.html:1: only one tcp server allowed"......one question sir for uploading html file is it another way or same like lua?..:-(..i have paste it in editor then save it as "s2.html' then write same in blank box below "upload file"..is it right way to download html file??
Are you sure? yes | no
mysite.html does not containt LUA code so you cant just execute it. It is used as a response string for web server.
Try to upload this code on ESP and tell me if it's working?
-- A simple http server
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
print(payload)
conn:send("Hello, NodeMcu.")
end)
conn:on("sent",function(conn) conn:close() end)
end)
Are you sure? yes | no
i uploaded mysite.html code to the esp in lualoader when i did "dofie"it is showing error like "mysite.html:1: unexpected symbol near '<' "what is that exactly??
Are you sure? yes | no
When you open IP location in browser you should see a green text "ESP8266 serial sniffer:".
If you don't see that then there is something wrong with the code on ESP... Or the IP is wrong...
If you loaded NodeMCU then you probably have USBtoSerial adapter? Try running the following command on ESP:
print(wifi.sta.getip())
to see what is the IP of the ESP. Then reupload init.lua with the correct IP (in the first line of code).
And also check what is your gateway and netmask by running "ipconfig" in windows cmd. And correct that values in init.lua if needed.
Are you sure? yes | no
i have used another arduino as serial device...which will send "hii"serially...
void setup() {
Serial.begin(9600); }
void loop() {
Serial.print("HI!");
delay(1000); }
then i have connect 1) rx of first arduino to 11 pin of second arduino..and
2)tx of first arduino to 10 pin of second arduino
3)rx tx of second arduino to tx rx of esp respectively...
~first i programmed 1 st arduino with above program
then ~ second one with your serial code as you posted in comment
then ~ in esp firstly i set ssid and passward of my wifi then download your mysite.html code then init.lua code thats all i did it ...esp's blue light is being flickring but on obtained ip it doesn't show anything..plz help
Are you sure? yes | no
ESP should be connected to arduino's pins 1 and 2. Which are hardware serial port like this:
Are you sure? yes | no
No connections are not ok.
On the top of the arduino code are instructions:
RX is digital pin 10 (connect to TX of other device)
TX is digital pin 11 (connect to RX of other device)
The "other device" is the device tha you wan't to listen to.
Are you sure? yes | no
yes sir i did all of it...it doesn't work..connections are ok n??
Are you sure? yes | no