[HTML/IMAGE] Controlling user-definable onboard LED

[HTML/IMAGE] Controlling user-definable onboard LED

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

We will go through an example to control user-definable onboard LED via a hyperlink embedded image by using a PHPoC Blue.

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.5">
<style> body { text-align: center; }</style>
</head>
<body>
 
<h2>
 
UIO / On-Board User LED<br>
 
<br>
 
<?php
 
include_once 
"/lib/sd_340.php";
 
define
("OUT_PIN", 30);
 
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 "<a href='index.php?led0=high'><img src='button_push.png'></a><br>\r\n";
else
    echo "<a href='index.php?led0=low'><img src='button_pop.png'></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