Saturday 15 June 2013

251 - Development

After understanding how Xampp works I came up with the following code to send a request with PHP to the port of my computer that was being used by the arduino, and finally, send that "a" key to the arduino serial:


<?php
if ($_REQUEST["tv"] != "")
{
switch ($_REQUEST["tv"])
{

case "volumeup" : $acao = "q"; break;
case "volumedown" : $acao = "w"; break;
case "ligardesligar" : $acao = "l"; break;
case "channelup" : $acao = "e"; break;
case "channeldown" : $acao = "r"; break;
}
$conexaoArduino = fopen("COM4","w");
fwrite($conexaoArduino,$acao);
fclose($conexaoArduino);
}
?>

No comments:

Post a Comment