mirror of
https://github.com/elua/elua.git
synced 2025-01-08 20:56:17 +08:00
51 lines
1.7 KiB
Plaintext
51 lines
1.7 KiB
Plaintext
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html><head><title>eLua webserver test</title>
|
|
</head><body>
|
|
<p align="center"><big>Welcome to the <b>eLua</b> web server!</big><br></p>
|
|
<br>
|
|
<div style="text-align: left;">The right column of the following table is generated by embedded Lua code:<br>
|
|
<br>
|
|
<table width="400" border="1" cellpadding="2" cellspacing="2">
|
|
<tbody>
|
|
<tr>
|
|
<td><b>eLua CPU</b></td>
|
|
<td><?lua print(pd.cpu()) ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td><b>eLua board</b></td>
|
|
<td><?lua print(pd.board()) ?></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<br>
|
|
And now let's test CGI. Use the form below to control the on-board LED.<br><br>
|
|
<form method="get" action="/index.pht" name="led">
|
|
<table width="400" border="0" cellpadding="2" cellspacing="2">
|
|
<tbody>
|
|
<tr>
|
|
<td style="center"><input type="submit" value="Led ON" name="ledon"></td>
|
|
<td style="center"><input type="submit" value="Led OFF" name="ledoff"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
<?lua
|
|
pio.pin.setdir( pio.OUTPUT, pio.PF_0 )
|
|
if reqdata['ledon'] then
|
|
pio.pin.sethigh( pio.PF_0 )
|
|
print '<br><font color="blue"><b>The LED is now ON</b></font><br>'
|
|
elseif reqdata['ledoff'] then
|
|
pio.pin.setlow( pio.PF_0 )
|
|
print '<br><font color="blue"><b>The LED is now OFF</b></font><br>'
|
|
elseif next(reqdata) ~= nil then
|
|
print '<br><font color="red"><b>Invalid CGI request!</b></font><br>'
|
|
end
|
|
?>
|
|
<br>
|
|
|
|
Press <a href="/test.lua">here</a> to go to a test page generated completely by a Lua script.<br>
|
|
<br>
|
|
<span style="font-weight: bold;">AND MOST IMPORTANTLY... remember to have fun with eLua! :)</span><br>
|
|
</div>
|
|
</body></html>
|