I'm trying to turn on a led through a web browser with PHP and Python. Next are the codes of my php program and the python one.
Code: Select all
PHP:
<!DOCTYPE html>
<html lang = .es.>
<head>
<title>Control remoto</title>
</head>
<body>
<?php
if(isset($_GET["prender"])){
exec("python prender.py");}
if(isset($_GET["apagar"])){
exec("python apagar.py");}
?>
<form method = "get">
<button type = "button" onclick="location.href='on-off.php?prender=true'">Prender</button>
<button type = "button" onclick="location.href='on-off.php?apagar=true'">Apagar</button>
</form>
</body>
</html>
Python:
import Adafruit_BBIO.GPIO as GPIO
GPIO.setup("USR3", GPIO.OUT)
GPIO.output("USR3", GPIO.HIGH)