Lua Socekt must be use in order to call sleep function in milliseconds.
An example to install Lua Socket to OpenWRT
opkg install luasocket
An example to sleep 10 milliseconds
Lua can only sleep/wait in seconds (not milliseconds) without install Lua Socket. Code below shows the sleep funciton.
delay = delay or 1
local time_to = os.time() + delay
while os.time() < time_to do end
Example to sleep 5 seconds
- TL-WR1043 router IP address: 192.168.1.1
- Device to be control (IP address) : 192.168.1.49
- Device to be control (Port) : 455
This is a tutorial to show image button on webpage, it use CSS.
See http://www.w3schools.com/css/default.asp for more information.
Below is an example to show two image buttons. <div class="img"> is the CSS, it is not define in this example, but it is working without any CSS style.
There is few ways to show image button on the webpage. Here I use <a.
|<a target="_parent" href="/newWebPage.php"><img src="/images/light_on.png" alt="Light" /></a>|
Above example shows an image with event. newWebPage.php will open if user click on the image.
- target="_parent" means open a new page when user click on the image. See http://www.w3schools.com/tags/att_a_target.asp for more information
- href= is the action. It will open newWebPage.php when user click on the image.
- img src= show the image on the page. It support many formats such as png, jpg, gif, bmp & others. I often use png & gif (animation) format since both support transparent.
- alt= will show the text if the associated image is not exist.
Note: IE8 and Google Chrome show output differently. There is a rectangular frame around the image if loaded with IE8, while Google Chrome did not show any frame.
See http://www.w3schools.com/tags/tag_a.asp for more information on how to use <a
Below example shows four images aligned in horizontally:
<a target="_parent" href="/newWebPage.php"><img src="/images/light_on.png" alt="Light" /></a>