I am trying to allow my simple website to check the time, so that if the set alarm time is equal to the real time the alarm goes off.
I'm using PHP (and I am pretty sure it must be in PHP due to using LEDs and python). I know this is relatively easy thing to do in js for example.
I have the variables:
$setTime = "$hour$hour2:$minutes$minutes2";
$realTime = date("H:i");
and a if statement:
if ($realTime == $setTime) {
exec("sudo python /home/pi/lighton_1.py");
}
else{
exec("sudo python /home/pi/lightoff_1.py");
}
This all works if when I load my website the real time = the set time however if not it won't. I somehow really want to check the if statement so often somehow. I have tried loops, functions etc and haven't had much success however my coding is a bit basic at the moment. Wondering if anyone knows this solution, (could be very simple?) Need help fast please. Thank you!