Controlling Output Ports


Calling spc_request_dev function for controlling output ports

spc_request_dev($sid, $cmd);

Structure of a command string is as follows:

"set $port output $value"

Example

<?php
include "/lib/sd_spc.php";
spc_reset();
spc_sync_baud();
$sid = 1;

echo "turn all output ports on\r\n";
spc_request_dev($sid, "set 0 output high");
spc_request_dev($sid, "set 1 output high");
spc_request_dev($sid, "set 2 output high");
spc_request_dev($sid, "set 3 output high");

sleep(1);

echo "turn all output ports off\r\n";
spc_request_dev($sid, "set 0 output low");
spc_request_dev($sid, "set 1 output low");
spc_request_dev($sid, "set 2 output low");
spc_request_dev($sid, "set 3 output low");
?>

output

turn all output ports on
turn all output ports off