Difference between revisions of "Talk:Сериен порт"
From Ilianko
m (moved Talk:Упражнение 3. Сериен порт (1) to Talk:Сериен порт) |
|||
| Line 1: | Line 1: | ||
| − | == | + | ==php== |
<code><pre> | <code><pre> | ||
| − | + | <?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> | ||
</pre></code> | </pre></code> | ||
| − | |||
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>