1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
<table>
<tr><td></td><td><a href="test.php?motor=avance"><img src="haut.png" width="100" height="100" alt="haut"></td><td></td></tr>
<tr><td><a href="test.php?motor=gauche"><img src="gauche.png" width="100" height="100" alt="Gauche"></td><td></td><td><a href="test.php?motor=droite"><img src="droite.png" width="100" height="100" alt="droite"></td></tr>
<tr><td></td><td><a href="test.php?motor=arriere"><img src="bas.png" width="100" height="100" alt="bas"></td><td></td></tr>
<?php
if($_GET['motor']!='')
{
//avance
if($_GET['motor']=='avance')
$message="\xff\x00\x01\x00\xff";
//gauche
if($_GET['motor']=='gauche')
$message="\xff\x00\x03\x00\xff";
//droite
if($_GET['motor']=='droite')
$message="\xff\x00\x04\x00\xff";
//arriere
if($_GET['motor']=='arriere')
$message="\xff\x00\x02\x00\xff";
echo strlen($message);
//Send the message to the server
if( ! socket_send ( $sock , $message , strlen($message) , 0))
{
$errorcode = socket_last_error();
$errormsg = socket_strerror($errorcode);
die("Could not send data: [$errorcode] $errormsg \n");
} |
Partager