Wiesemann & Theis GmbH

Networking, sensors and interface technology for industry, office and IT

Application for the Web-IO Digital:

Visualize Web-IO Digital


Inputs and outputs

The inputs, counter and outputs of the Web-IO Digital can be simply Visualized on a Web page using JavaScript and a few images. Incorporation of the Web-IO applet provides for continuous updating of the display.

Using the following copy&paste example you can represent your Web-IO Digital with its inputs and outputs on a Web page.

Preparations

You have already provided your Web-IO Digital

  • with power,
  • connected it to your network,
  • assigned it an IP address - which with WuTility is no problem.
1. Incorporate JavaScript into the Web page

Copy the JavaScript (shown in blue) from the following example into the <head> area of your Web page.

<html>
	<head>
		<title>Web-IO Digital: Inputs/Outputs</title>
		<script language="JavaScript" type="text/javascript">
		<!--
		var ypositopn = 175;
		var xposition = 87;
		var xdifferenc = 24;
		ledinput = new Array(12);
		ledoutput = new Array(12);

		for (i=0; i<4; i++)
			{
			ledinput[i] = new multipic(100+i,"led_","gif",1,ypositopn,xposition + i*xdifferenc,"nolink");
			status=i;
			}
		for (i=4; i<8; i++)
			{
			ledinput[i] = new multipic(100+i,"led_","gif",1,ypositopn,xposition + 26 + i*xdifferenc,"nolink");
			}
		for (i=8; i<12; i++)
			{
			ledinput[i] = new multipic(100+i,"led_","gif",1,ypositopn,xposition + 56 + i*xdifferenc,"nolink");
			}
		ypositopn = 327;
		for (i=0; i<4; i++)
			{
			ledoutput[i] = new multipic(200+i,"led_","gif",1,ypositopn,xposition + i*xdifferenc,"nolink");
			}
		for (i=4; i<8; i++)
			{
			ledoutput[i] = new multipic(200+i,"led_","gif",1,ypositopn,xposition + 3 + i*xdifferenc,"nolink");
			}
		for (i=8; i<12; i++)
			{
			ledoutput[i] = new multipic(200+i,"led_","gif",1,ypositopn,xposition + 5 + i*xdifferenc,"nolink");
			}
		document.write("<img border=’0’ src=’stickersmall.gif’ style=’position:absolute; top:160px; left:10px’>");
		function multipic(id, img_name, img_ext, img_count, ypos, xpos, link)
			{
			img_count++;
			this.multipics = new Array( img_count );
			this.multipic_count = img_count;
			this.multipic_id = id; // class variables
			for (ii=0; ii<img_count; ii++)
				{
				this.multipics[ii] = new Image();
				this.multipics[ii].src = img_name+ii+’.’+img_ext;
				}
			this.Set = picSet; // class method
			if (link == "nolink")
				{
				document.write("<img id=’"+this.multipic_id+"’ style=position:absolute;top:"+ypos+"px;left:"+xpos+"px src="+this.multipics[0].src+" border=0>");
				}
			else
				{
				document.write("<a href=’javascript:" + link + "(" + id + ");’><img id=’"+this.multipic_id+"’ style=position:absolute;top:"+ypos+"px;left:"+xpos+"px src="+this.multipics[0].src+" border=0></a>");
				}
			}
		function picSet(iCount)
			{
			for (ii=0; ii<this.multipic_count; ii++)
				{
				if(iCount==ii)
					{
					document.getElementById(this.multipic_id).src = this.multipics[ii].src;
					}
				}
			}
		function inputChanged( iDevice, iNr, iVal )
			{
			ledinput[iNr].Set(iVal);
			}
		function outputChanged( iDevice, iNr, iVal )
			{
			ledoutput[iNr].Set(iVal);
			}
		function setPassword()
			{
		document.applets["dio"].setPassword(document.forms[0].tfPassword.value );
			document.forms[0].tfPassword.value = ’’;
			}
	</script>
</head>
... 
2. Incorporate applet into Web page
  • Copy the applet data (in blue) to the <body> area of your Web page.
  • Insert the IP address of your Web-IO Analog.
 ...
<body style="background-color: #0099CC; font-family: Arial, Helvetica, sans-serif;">
	<applet name="dio" archive="dio.jar" code="dio.class" codebase="http://10.40.50.5" height="0" width="0" mayscript>
		<param name="device" value="0">
		<param name="showerrors" value="off">
		<param name="inputpolling" value="on">
		<param name="outputpolling" value="on">
		<param name="counterpolling" value="off">
		<param name="pollingrate" value="1000">
		Java ist nicht aktiviert oder wird nicht unterstützt
	</applet>
...
3. Password form

If your Web-IO is password protected, also copy the password form (shown in blue) to the <body> area of your Web page. In this case the Web page can only communicate with the Web-IO after the password has been sent.

 ...
	<form>
		<p>Passwort:
			<input type="password" name="tfPassword" maxlength="31" size="20">
			<input type="button" value="senden" onclick="setPassword()">
		</p>
	</form>

</body>
</html>
4. Download and save images

Now you just need the images associated with the display object, which we have provided here for downloading: .zip (approx. 9 kB). Please place the images in the directory in which the Web page with the JavaScript and applet data are located.

Download program example

You don’t have a Web-IO yet but would like to try the example out sometime?

No problem: We will be glad to send you the Web-IO Digital 2xInput, 2xOutput PoE at no charge for 30 days. Simply fill out a sample ordering form, and we will ship the Web-IO for testing on an open invoice. If you return the unit within 30 days, we will simply mark the invoice as paid.

To sample orders
^