SWiSH Forum
Forum u¿ytkowników programów SWiSH

Skrypty do programu SWiSH2 i SWISHmax - Potrzebuje pomocy w sterowanie portu LPT

shazzy - Sro 26 Gru, 2007 12:38
Temat postu: Potrzebuje pomocy w sterowanie portu LPT
Hey, i need some help let's start from the begining.

What i need to do?
I need to make an aplication witch will controll my paludarium from a lokal pc but i also need to check port status of warious pins and ocasionally chagne from outside world those walues. Ex. pomp, waterfall, rain, auto water refill, wents...

What i have found and what i got?
I have found this really nice site ( http://www.epanorama.net/...lel_output.html ) where is a working ajax serwer with php i manage to setup ewerything fine working (here is my working wersion: http://89.228.218.197:800...ol/control.php) i managed to change names etc know where are buttons and what they do here is all from control.php site

"
<?
require("Sajax.php");

function portstatus() {
return " Time: " . date("M dS, Y, H:i:s ") . "Status: " . shell_exec("portcontrol.exe LPT1DATA read print bin");
}

function portcontrol($x, $y) {
if (($x >= 0) && ($x < 8) ) {
if ($y == 1)
shell_exec("portcontrol.exe LPT1DATA read setbit " . $x . " write");
else
shell_exec("portcontrol.exe LPT1DATA read resetbit " . $x . " write");
}
return portstatus();
}

sajax_init();
// $sajax_debug_mode = 1;
sajax_export("portstatus");
sajax_export("portcontrol");
sajax_handle_client_request();

?>
<html>
<head>
<title>Port control</title>
&lt;script>
<?
sajax_show_javascript();
?>

function do_portstatus_cb(z) {
// update status field in form
document.getElementById("status").value = z;
}

function do_portstatus() {
x_portstatus(do_portstatus_cb);
setTimeout('do_portstatus();',5000); // executes the next data query in every n milliseconds
}

function do_portcontrol_cb(z) {
// update status field in form
document.getElementById("status").value = z;
}

function do_portcontrol(bit,value) {
x_portcontrol(bit,value,do_portcontrol_cb);
}

</script>

</head>
<body>

&lt;script LANGUAGE="JavaScript">
<!--
do_portstatus();
// -->
</SCRIPT>

<P>

<H1>Centrum kontroli paludarium on-line</H1>
<P>

<input type="text" name="status" id="status" value="No status yet" size="60">

<P>

Wodospad________________
:
<input type="button" name="check" value="W&Aring;‚Ä…cz"
onclick="do_portcontrol(0,1); return false;">
<input type="button" name="check" value="Wy&Aring;‚Ä…cz"
onclick="do_portcontrol(0,0); return false;">
<BR>
Deszcz___________________
:
<input type="button" name="check" value="W&Aring;‚Ä…cz"
onclick="do_portcontrol(1,1); return false;">
<input type="button" name="check" value="Wy&Aring;‚Ä…cz"
onclick="do_portcontrol(1,0); return false;">
<BR>
Filtr_____________________
:
<input type="button" name="check" value="W&Aring;‚Ä…cz"
onclick="do_portcontrol(2,1); return false;">
<input type="button" name="check" value="Wy&Aring;‚Ä…cz"
onclick="do_portcontrol(2,0); return false;">
<BR>
Wyrównanie poziomu wody___
:
<input type="button" name="check" value="W&Aring;‚Ä…cz"
onclick="do_portcontrol(3,1); return false;">
<input type="button" name="check" value="Wy&Aring;‚Ä…cz"
onclick="do_portcontrol(3,0); return false;">
<BR>
O&Aring;›wietlenie dzienne__________:
<input type="button" name="check" value="W&Aring;‚Ä…cz"
onclick="do_portcontrol(4,1); return false;">
<input type="button" name="check" value="Wy&Aring;‚Ä…cz"
onclick="do_portcontrol(4,0); return false;">
<BR>
O&Aring;›wietlenie nocne__________
:
<input type="button" name="check" value="W&Aring;‚Ä…cz"
onclick="do_portcontrol(5,1); return false;">
<input type="button" name="check" value="Wy&Aring;‚Ä…cz"
onclick="do_portcontrol(5,0); return false;">
<BR>
Ogrzewanie_______________
:
<input type="button" name="check" value="W&Aring;‚Ä…cz"
onclick="do_portcontrol(6,1); return false;">
<input type="button" name="check" value="Wy&Aring;‚Ä…cz"
onclick="do_portcontrol(6,0); return false;">
<BR>
Ch&Aring;‚odzenie________________
:
<input type="button" name="check" value="W&Aring;‚Ä…cz"
onclick="do_portcontrol(7,1); return false;">
<input type="button" name="check" value="Wy&Aring;‚Ä…cz"
onclick="do_portcontrol(7,0); return false;">
<BR>

<P>
<HR>

<P>
<center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0"
id="Movie1" width="400" height="300">
<param name="movie" value="Movie1.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<embed name="Movie1" src="Movie1.swf" quality="high" bgcolor="#FFFFFF"
width="400" height="300"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</embed>
</object>
</center></body>
</html>

"

so what whe see is that main execution (turning on/off) is by these commands

<BR>
Ogrzewanie_______________
:
<input type="button" name="check" value="W&Aring;‚Ä…cz"
onclick="do_portcontrol(6,1); return false;">
<input type="button" name="check" value="Wy&Aring;‚Ä…cz"
onclick="do_portcontrol(6,0); return false;">

Ewerything works as it should no problem with that

What i want to do is to implement an swish movie into this in wich i will make rest auto times and any other that i know how to do.
My problem is that for now i don't know how to make a simple mowie (a button for turning on and button for turning off the pin on port)

Hope this post will help not only me but other i saw that there are many post on controling parallel port in swish but there are only answers about serial

So what i want and ask for is that for is to help make first simple flash movie implemented to this script like i want to make it

Thanks for any help and wish u marry x mas


Powered by phpBB modified by Przemo © 2003 phpBB Group