Last active
November 26, 2018 21:58
-
-
Save ThePratikSah/741a22b1f93a2c8f5c425a75ba6bae85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Pi Remote Control</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"> | |
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" | |
crossorigin="anonymous"> | |
</head> | |
<body> | |
<?php | |
if(isset($_POST['ON'])){ | |
exec("sudo python lightOn.py"); | |
} | |
if(isset($_POST['OFF'])){ | |
exec("sudo python lightOff.py"); | |
} | |
?> | |
<div class="row"> | |
<div class="col s12 m5"> | |
<div class="card-panel teal"> | |
<blockquote class="white-text"> | |
<h4>Control your lights from here!</h4> | |
</blockquote> | |
</div> | |
</div> | |
</div> | |
<div class="row center"> | |
<div class="col s12 m5"> | |
<div class="card-panel"> | |
<!-- button starts here --> | |
<form method="post"> | |
<button class="waves-effect waves-light btn" name="ON">Turn ON <i class="fas fa-lightbulb"></i></button> | |
<button class="waves-effect waves-light btn" name="OFF">Turn OFF <i class="far fa-lightbulb"></i></button> | |
</form> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
import time | |
GPIO.setmode(GPIO.BCM) | |
pinList = [2] | |
for i in pinList: | |
GPIO.setwarnings(False) | |
GPIO.setup(i, GPIO.OUT) | |
GPIO.output(i, GPIO.HIGH) | |
def trigger(): | |
for i in pinList: | |
GPIO.output(i, GPIO.LOW) | |
break | |
try: | |
trigger() | |
except KeyboardInterrupt: | |
print("Quit") | |
GPIO.cleanup() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
import time | |
GPIO.setmode(GPIO.BCM) | |
pinList = [2] | |
for i in pinList: | |
GPIO.setwarnings(False) | |
GPIO.setup(i, GPIO.OUT) | |
GPIO.output(i, GPIO.HIGH) | |
def trigger(): | |
for i in pinList: | |
GPIO.output(i, GPIO.HIGH) | |
break | |
try: | |
trigger() | |
except KeyboardInterrupt: | |
print("Quit") | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment