[HTML/TEXT] Controlling a buzzer

[HTML/TEXT] Controlling a buzzer

Postby admin » Wed Nov 04, 2015 3:32 pm

We will go through an example to control a buzzer via a hyperlink embedded HTML by using a PHPoC Blue.

Image

PHPoC Blue Diagram
Image

Source Codes
1. index.php

Code: Select all

<html>
<head>
<title>PHPoC / <?echo system("uname -i")?></title>
<meta name="viewport" content="width=device-width, initial-scale=0.7">
<style> body { text-align: center; }</style>
</head>
<body>
 
<h2>
 
UIO / Catalex Buzzer<br>
 
<br>
 
<?php
 
include_once 
"/lib/sd_340.php";
 
define
("OUT_PIN", 0);
 
uio_setup
(0, OUT_PIN, "out");
 
if(($led0 = _GET("led0")))
{
    if($led0 == "low")
        uio_out(0, OUT_PIN, LOW);
    else
        uio_out
(0, OUT_PIN, HIGH);
}
 
if(uio_in(0, OUT_PIN) == LOW)
{
    echo "Buzzer Status : OFF<br>\r\n";
    echo "<br><a href='index.php?led0=high'>Toggle</a><br>\r\n";
}
else
{
    echo "Buzzer Status : ON<br>\r\n";
    echo "<br><a href='index.php?led0=low'>Toggle</a><br>\r\n";
}
 
?>
 
</h2>
 
</body>
</html>


Please download a PSP (PHPoC Support Package) of libraries and examples from PHPoC, and upload it in the PHPoC Blue.




Video

phpBB [video]
admin
Site Admin
 
Posts: 167
Joined: Mon Jan 20, 2014 4:40 pm

Return to Example

Who is online

Users browsing this forum: No registered users and 1 guest