Skip to content

Instantly share code, notes, and snippets.

@tombrad
Created July 29, 2017 20:24
Show Gist options
  • Save tombrad/7ebebc21919a81ba1deca5143eba6573 to your computer and use it in GitHub Desktop.
Save tombrad/7ebebc21919a81ba1deca5143eba6573 to your computer and use it in GitHub Desktop.
Página PHP para llamar a programas en Python (Autor Diego Torres)
<html>
<head>
<?php
if (isset($_POST['LedON']))
{
exec('sudo python /var/www/html/raspduino/enciendeled.py');
}
if (isset($_POST['LedOFF']))
{
exec('sudo python /var/www/html/raspduino/apagaled.py');
}
?>
<title>Led Arduino</title>
</head>
<body>
<form method="post">
<table
style="width: 75%; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="text-align: center;">Turn LED on</td>
<td style="text-align: center;">Turn LED off</td>
</tr>
<tr>
<td style="text-align: center;"><button name="LedON">Led On</button></td>
<td style="text-align: center;"><button name="LedOFF">Led Off</button></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment