Internet Signage
[Product]
PBH-101/104/204
[Sensor/Module]
Electronic Signage
[How it works]
a. Codes work with web interface
b. Once you click the [Send] button on the webpage, it sends the text with optional effects to the electronic signage
[video]
[Source Code - task0.php]
PHP Code:
<?php
include "/lib/sd_204.php";
uart_setup(0, 115200, "N81N");
//uart_write(0, "[TMODE]\r[COMON][FINE][COMOFF]");
uart_write(0, "[TMODE]\r[COMON][PX0 PY0]Waiting Messages..[ACT0][COMOFF]");
for(;;)
;
?>
[Source Codes - index.php]
PHP Code:
<?php
include_once "/lib/sd_204.php";
include_once "func.php";
header("Content-Type: text/html; charset=euc-kr");
$str_send = "";
$read_data = 0;
$str_send = _POST("str_send");
$repetition = (int)_POST("repetition");
$animation = (int)_POST("animation");
$color = (int)_POST("color");
$position = (int)_POST("position");
$repeat = strlen(_POST("repeat"));
uart_setup(0, 115200, "N81N");
uart_write(0, "[TMODE]\r");
if($repeat != 0)
{
led_setup(LED_A, "out");
led_out(LED_A, LOW);
uart_write(0, "[COMON][FINE][COMOFF]");
}
else
{
if(strlen($str_send))
{
uart_write(0, "[COMON]");
if($repetition != 0)
uart_write(0, f_repetition($repetition));
uart_write(0, f_position($position));
uart_write(0, f_color($color));
uart_write(0, $str_send);
uart_write(0, f_animation($animation));
uart_write(0, "[COMOFF]");
$str_send = "";
}
else
uart_write(0, "[COMON][PX0 PY0][ACT0][COMOFF]");
}
?>
<html>
<head>
<title>Internet Signboard</title>
<meta content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width" name="viewport">
</head>
<body>
<center>
<h2><p>Internet Signboard</p></h2></td>
<table>
<form method = "post" name = "signboard">
<tr bgcolor = "#999999">
<th align = "left">Effects</th>
<th colspan = "4">Options</th>
</tr>
<tr bgcolor = "#eeeeee">
<td>Position: </td>
<td><input type = "radio" name = "position" value = "0" />Top</td>
<td><input type = "radio" name = "position" value = "1" checked />Middle</td>
<td colspan = "2"><input type = "radio" name = "position" value = "2" />Bottom</td>
</tr>
<tr bgcolor = "#e8e8e8">
<td>Repetition: </td>
<td><input type = "radio" name = "repetition" value = "0" checked />None</td>
<td><input type = "radio" name = "repetition" value = "1" />3</td>
<td><input type = "radio" name = "repetition" value = "2" />10</td>
<td><input type = "radio" name = "repetition" value = "3" />Infinite</td>
</tr>
<tr bgcolor = "#e0e0e0" height = "30">
<td rowspan = "2">Animation: </td>
<td><input type = "radio" name = "animation" value = "0" checked />None</td>
<td><input type = "radio" name = "animation" value = "1" />Flow_Left</td>
<td><input type = "radio" name = "animation" value = "2" />Flow_Right</td>
<td><input type = "radio" name = "animation" value = "3" />Flow_Up</td>
</tr>
<tr bgcolor = "#dedede">
<td><input type = "radio" name = "animation" value = "4" />Flow_Down</td>
<td><input type = "radio" name = "animation" value = "5" />Flow_Left2</td>
<td><input type = "radio" name = "animation" value = "6" />Flow_Left3</td>
<td><input type = "radio" name = "animation" value = "7" />Random</td>
</tr>
<tr bgcolor = "#d8d8d8">
<td>Color: </td>
<td><input type = "radio" name = "color" value = "0" checked /><font color = "orange">Orange</font></td>
<td><input type = "radio" name = "color" value = "1" /><font color = "red">Red</font></td>
<td colspan = "2"><input type = "radio" name = "color" value = "2" /><font color = "green">Green</font></td>
</tr>
<tr bgcolor = "#d0d0d0">
<td>Message: </td>
<td colspan = "4"><textarea name = "str_send" rows = "2" cols = "60" maxlength = "78"></textarea></td>
</tr>
<tr align = "right">
<td colspan = "4">Initialize<input type = "checkbox" name = "repeat"></td>
<td><input type = "submit" name = "send_data" value = "Send"></td>
</tr>
<tr align = "right">
<td colspan = "5"><a href="index.php"> Refresh </a></td>
</tr>
<tr>
<td align = "left" colspan = "5">
<font color = "red">Notice: Please check the [Initialize] checkbox and press the [Send] button
<br />before you test this Signboard.</font></td>
</tr>
</form>
</table>
</center>
</body>
</html>
[/code]
[Source Code - func.php]
[code=php]
<?php
function f_position($val)
{
$ret = "";
switch($val)
{
case 0:
$ret .= "[PX0 PY0]";
break;
case 1:
$ret .= "[PX0 PY7]";
break;
case 2:
$ret .= "[PX0 PY16]";
break;
default:
$ret .= "[PX0 PY0]";
break;
}
return $ret;
}
function f_repetition($val)
{
$ret = "";
switch($val)
{
case 1:
$ret .= "[REPEAT3]";
break;
case 2:
$ret .= "[REPEAT10]";
break;
case 3:
$ret .= "[REPEAT255]";
break;
}
return $ret;
}
function f_color($val)
{
$ret = "";
switch($val)
{
case 0:
$ret .= "[CR3]";
break;
case 1:
$ret .= "[CR1]";
break;
case 2:
$ret .= "[CR2]";
break;
default:
$ret .= "[CR3]";
break;
}
return $ret;
}
function f_animation($val)
{
$ret = "";
switch($val)
{
case 0:
$ret .= "[ACT0]";
break;
case 1:
$ret .= "[ACT1]";
break;
case 2:
$ret .= "[ACT2]";
break;
case 3:
$ret .= "[ACT3]";
break;
case 4:
$ret .= "[ACT4]";
break;
case 5:
$ret .= "[ACT8]";
break;
case 6:
$ret .= "[ACT22]";
break;
case 7:
$ret .= "[ACT";
$temp = rand(1, 5) * 100;
$temp += rand(1, 20);
$ret .= (string)$temp;
$ret .= "]";
break;
default:
$ret .= "[ACT0]";
break;
}
return $ret;
}