Things used in this project

Hardware components:
Phpoc black per 1000x1000 ppghn9ufqi
PHPoC Black
×1
Rs232 stack board txwsxx6fml
PHPoC RS232 Expansion Board
×1
LED Signboard
×1

Code

index.phpPHP
<?php

include_once "/lib/sd_340.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"));
$repeat = _POST("repeat");

uart_setup(0, 115200, "N81N");
uart_write(0, "[TMODE]\r");

if($repeat == "init")
{
	uart_write(0, "[COMON][FINE][COMOFF]");
	usleep(100000);
	uart_write(0, "[COMON][PX0 PY0][ACT0][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]");
}
?>
<!DOCTYPE html>
<html>
<head>
  <!-- Include meta tag to ensure proper rendering and touch zooming -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Include jQuery Mobile stylesheets -->
  <link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
  <!-- Include the jQuery library -->
  <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
  <!-- Include the jQuery Mobile library -->
  <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
  <script type="text/javascript">
  function init() {
	if(confirm("Do you want to initialize signboard?")  ){ 
		document.form.repeat.value = "init";
		document.form.submit();
	}
  }
  
  function refresh() {
	window.location.href = "index_m.php";
  }
  
  function send_message() {
	if(confirm("Do you want to send message?")  ){
		document.form.submit();	  
      }
  }
  </script>
</head>
<body>

<div data-role="page" id="pageone">
  <div data-role="header">
    <h1>Internet Signboard</h1>
  </div>

  <div data-role="main" class="ui-content">
    <p style="color:red;">Notice: Please check the [Initialize] button before you test this Signboard.</p>
    <div class="ui-grid-b">
    	<div class="ui-block-c"><input type="button" value="Initialize" onclick="init();"></div>
        <div class="ui-block-c"><input type="button" value="Refresh" onclick="refresh();"></div>
        <div class="ui-block-c"><input type="button" value="Send" onclick="send_message();"></div>

    </div>
    
    <form name="form" method="post" action="index_m.php">
        <fieldset class="ui-field-contain">
        	<label for="message">Message</label>
            <textarea name="str_send" id="str_send"></textarea>
        </fieldset>
    	<fieldset class="ui-field-contain">
        	<label for="position">Position</label>
            	<select name="position" id="position">
                	<option value="0">Top</option>
                    <option value="1" selected>Middle</option>
                    <option value="2">Bottom</option>
                </select>
        </fieldset>
    	<fieldset class="ui-field-contain">
        	<label for="repetition">Repetition</label>
            	<select name="repetition" id="repetition">
                	<option value="0" selected>None</option>
                    <option value="1">1</option>
                    <option value="2">10</option>
                    <option value="3">Infinite</option>
                </select>
        </fieldset>        
    	<fieldset class="ui-field-contain">
        	<label for="color">Color</label>
            	<select name="color" id="color">
                	<option value="0" selected>Orange</option>
                    <option value="1">Red</option>
                    <option value="2">Green</option>
                </select>
        </fieldset>        
     	<fieldset class="ui-field-contain">
        	<label for="animation">Animation</label>
            	<select name="animation" id="animation">
                	<option value="0" selected>None</option>
                    <option value="1">Flow Left</option>
                    <option value="2">Flow Right</option>
                    <option value="3">Flow Up</option>
                    <option value="4">Flow Down</option>
                    <option value="5">Random</option>
                </select>
        </fieldset>        
        <input type="hidden" name="repeat" id="repeat" value=""/>
    </form>
  </div>
  
  

  <div data-role="footer" data-position="fixed">
    <h1>Sollae Systems Co., Ltd.</h1>
  </div>
</div> 

</body>
</html>
func.phpPHP
<?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;
}
task0.phpPHP
<?php

include "/lib/sd_340.php";

uart_setup(0, 115200, "N81N");

uart_write(0, "[TMODE]\r[COMON][PX0 PY0]Waiting Messages..[ACT0][COMOFF]");

for(;;)
	;

?>

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Monitoring the Trash Can
Easy
  • 239
  • 7

Full instructions

Status of trash can in public area is monitored. When the trash can is full, an email is sent to trash manager or status of trash can.

Alcohol Gas Detector
Easy
  • 206
  • 9

Full instructions

I made a simple project called "Alcohol Gas Detector".

MQTT for IoT Devices, Support TLS/SSL, QoS Level: 0, 1, 2
Easy
  • 211
  • 7

Protip

This project describes MQTT library for an IoT Platfrom so-called PHPoC. This library supports MQTT over TLS/SSL and all QoS Level: 0, 1, 2.

IFTTT's Android SMS Service with PHPoC Blue
Easy
  • 303
  • 7

This project shows how to use IFTTT Maker channel.

Web-based Temperature and Humidity Monitoring
Easy
  • 252
  • 8

Full instructions

Web-based Temperature and Humidity Monitoring

Parking System
Easy
  • 209
  • 8

Full instructions

I made a simple project called "smart car parking system".

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback