<html>
<body>
<h1>LED switch for mbed</h1>
<hr/>
<?php
require_once("../../lib/MiMicPhpApi/LPCXpresso1769/MiMic_LPCXpresso1769.php");


//テストするサーバのIPアドレス
//GPIOのOUTPUT PIN設定
$OUTPUT_PIN=array('dir'=>1,'pin'=>array('mode'=>1,'od'=>0));

/**
 * LED switch
 */
function gpioport($ip,$v)
{
	global $OUTPUT_PIN;
	$mcu=new MiMic_LPC1769_Mcu($ip);
	$port=$mcu->getPort(
		MiMic_LPCXpresso1769::$LED //array of LED
		,"GPIO");
	$port->setOpt($OUTPUT_PIN);
	$port->setValue($v==0?0:0xffffffff);
}
if(isset($_GET['ip']) && isset($_GET['v'])){
	gpioport($_GET['ip'],$_GET['v']);
}
?>
<form method="get" action="sw_lpcxpresso1769.php">
<input name="ip" type="text" value="<?php echo($_GET['ip']) ?>"></input>
<input name="v" type="submit" value="1">ON</input>
<input name="v" type="submit" value="0">OFF</input>
</form>
</body>
</html>
