Загрузка данных


<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LED Control</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            margin-top: 50px;
        }
        form {
            margin: 20px;
        }
        input[type="submit"] {
            font-size: 18px;
            padding: 10px 20px;
            margin: 5px;
            cursor: pointer;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
        }
        input[type="submit"][name="off"] {
            background-color: #f44336;
        }
        .status {
            margin-top: 20px;
            font-size: 18px;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <h1>LED Control</h1>
    
    <form method="get" action="">
        <input type="submit" value="ON" name="on">
        <input type="submit" value="OFF" name="off">
    </form>

    <div class="status">
        <?php
        // Устанавливаем режим пина 17 как выход
        $setmode17 = shell_exec("/usr/local/bin/gpio -g mode 17 out");
        
        if(isset($_GET['on'])){
            $gpio_on = shell_exec("/usr/local/bin/gpio -g write 17 1");
            echo "LED is ON";
        }
        else if(isset($_GET['off'])){
            $gpio_off = shell_exec("/usr/local/bin/gpio -g write 17 0");
            echo "LED is OFF";
        }
        ?>
    </div>
</body>
</html>