Advertisement
Guest User

Raspberry pi GPIO light a led

a guest
Dec 25th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <html>
  2. <head>
  3. <meta name="viewport" content="width=device-width" />
  4. <title>LED Control</title>
  5. </head>
  6.         <body>
  7.         LED Control:
  8.         <form method="get" action="index.php">
  9.                 <input type="submit" value="ON" name="on">
  10.                 <input type="submit" value="OFF" name="off">
  11.         </form>
  12.         <?php
  13.  
  14.         $setmode17 = shell_exec("/usr/local/bin/gpio mode 7 out");
  15.  
  16.             if(isset($_GET['on'])){
  17.             while (1){
  18.                         $gpio_on = shell_exec("/usr/local/bin/gpio write 7 1");
  19.                         echo "LED is on";
  20.                     sleep(1);
  21.                         $gpio_off = shell_exec("/usr/local/bin/gpio write 7 0");
  22.                         echo "LED is off";
  23.                 sleep(1);
  24.             }
  25.         }
  26.  
  27.         ?>
  28.         </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement