hackhitchin / esp8266-co-uk Goto Github PK
View Code? Open in Web Editor NEWContent for esp8266 website.
Home Page: http://esp8266.co.uk
Content for esp8266 website.
Home Page: http://esp8266.co.uk
Your debounce code at https://github.com/hackhitchin/esp8266-co-uk/blob/master/tutorials/introduction-to-gpio-api.md was (indirectly) discussed at http://www.esp8266.com/viewtopic.php?f=24&t=4833&start=5#p29127. It essentially says
tmr.now() rolls over at 2147 seconds - the NodeMCU API page indicates uint31, not uint32, which means it wraps to zero when it reaches the max value for int32. The value (now - last) will be negative when (last) gets really big and (now) wraps around.
And it goes on to propose adding if delta < 0 then delta = delta + 2147483647 end;
as a remedy.
-> https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en#tmrnow
wifi.setmode(wifi.SOFTAP)
-----------------------------------------------------------------------------
print("Starting Web Server...")
-- Create a server object with 30 second timeout
srv = net.createServer(net.TCP, 80)
-- server listen on 80,
srv:listen ( 80,function(conn)
conn:on( "receive",function(conn,payload)
if(receive_flag ~= true ) then
decode(payload)
conn:send(ack_data)
ack_data="nope";
else
file.open("frame/data.rin","w")
file.writeline(payload);
file.close();
conn:send("FR complete");
receive_flag = false;
end
end)
end)
while true do
file.open("frame/data.rin","r")
file.readline();
file.close();
if(new == true ) then
--print("r")
todmd(); --
else
gpio_toggle(j)
if(j==3)then
j=0;
if(c==60) then
c=0;
new = true;
else
c=c+4;
end
else
j=j+1;
end
end
tmr.wdclr()
end
function todmd()
for row=0,3,1 do
gpio_toggle(row)
spi.send(1,0xf0,0xf0,0xf0,0xf0,0xf0,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1)
gpio.write(6, gpio.LOW)
gpio.write(6, gpio.HIGH)
gpio.write(6, gpio.LOW)
tmr.wdclr()
end
end
while running the above code the mobile not connected to esp8266 ,when i remove the while loop
there is no problem to connect devices. what is the actual problem here i cant fix it ,i try different firmware but the result is same. any solution to solve this
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.