Difference between revisions of "Talk:Сериен порт"

From Ilianko
Line 1: Line 1:
== programata ne e vqrna ==
+
==php==
  
  
 
<code><pre>
 
<code><pre>
int x = 61;
+
<?php
char y;
+
 
y = (int) x;
+
if(isset($_POST['message']))
printf( " %c ", y );
+
{
 +
  $fp =fopen("/dev/ttyS0", "w");
 +
  if( !$fp) {
 +
    echo "Error";die();
 +
  }
 +
 
 +
  fwrite($fp, "$_POST[message] \n");
 +
  fclose($fp);
 +
}
 +
 
 +
?>
 +
<html><head></head>
 +
<body>
 +
<form name="serial" action="" method="post">
 +
Message:  <input name="message" type="text"><input type="submit" value="Send">
 +
</form>
 +
</body>
 +
</html>
 
</pre></code>
 
</pre></code>
--[[Special:Contributions/194.141.252.126|194.141.252.126]] 10:55, 24 March 2011 (EET)
 

Revision as of 13:39, 21 February 2013

php

<?php

if(isset($_POST['message']))
{
  $fp =fopen("/dev/ttyS0", "w");
  if( !$fp) {
    echo "Error";die();
  }

  fwrite($fp, "$_POST[message] \n");
  fclose($fp);
}

?>
<html><head></head>
<body>
<form name="serial" action="" method="post">
Message:  <input name="message" type="text"><input type="submit" value="Send">
</form>
</body>
</html>