<!DOCTYPE html>
<html>
<head>
<title>gestion carte ARDUINO sur COM7</title>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
</head>
<body>
<article>
<h1>Gérer une liaison entre PHP et une carte Arduino</h1>
<?php
$device = "COM7";
exec("mode $device BAUD=38400 PARITY=n DATA=8 STOP=1 xon=off octs=off rts=on");
$comport = @fopen($device, "wb+");
var_dump($comport);
if ($comport) {
sleep(1);
fputs($comport,"
");
sleep(1);
$result = fgets($comport);
var_dump($result);
fputs($comport,"words
");
sleep(1);
$result = fgets($comport);
var_dump($result);
sleep(1);
$result = fgets($comport);
var_dump($result);
fclose($comport);
}
?>
</body>
</html>