Data Sheet
dScript
dScript User Manual v2.15
HTTP web server
Using the dScript web server, you can write and upload your own web pages to the module.
Your website can display your own variables in any manner you choose, using AJAX techniques
to keep the variables live and updated. You can use buttons on the web page to control things
on the module and, of course, your own branding applied to the page. You can use CSS to
format your website and include any images, logo's required. Modules have at least 2MB of
storage for web pages.
Note that all web files (html, css, javascript, pictures etc) must be stored in one directory. The
web compiler does not support a directory structure with multiple levels.
Lets start with a very simple web page, this will be a single button on the page called "Yard
Lights". The following html should be saved as index.htm and stored in a webpage directory on
your computer.
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dweb Simple Test Page</title>
</head>
<body>
<button>Yard Lights</button>
</body>
</html>
For convenience we will want our module at a fixed IP address, so also save the following
dScript program.
tcpip.hostname "dS3484"
tcpip.ip "192.168.0.137"
tcpip.mask "255.255.255.0"
main: do
loop
It just sets the IP address and mask, make sure your computer is on the same subnet
(192.168.0.xxx in this case). The do loop is currently empty as we have no program to run
yet. Make sure the web page directory is selected using the blue world web symbol in the
menu bar, then load your program.
Type 192.168.0.137/index.htm into your browser and you should see your button at the top
left, note that our web server will (deliberately) NOT serve a default page. You must type in
the full page name that you want. Typing the IP address only will result in a 404 file not found
error.
You now have your first web page up and running, so lets make that button do something. We
will use it to toggle a relay on the module. Also we will get the actual state of the relay from
the module and use this to set the button colour.
Copyright © 2016, Devantech Ltd.
All rights reserved.
www.robot-electronics.co.uk
41