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


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

/**
 * This test sets value 3 to GPIO pin set.
 */
function gpioport($ip,$v)
{
	global $OUTPUT_PIN;
	$mcu=new MiMic_LPC1769_Mcu($ip);
	$port=$mcu->getPort(
		MiMic_MbedM3::$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_mbedm3.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>
