spc_request_dev($sid, $cmd);
Structure of a command string is as follows:
"get $port input"
The normal return value is in string form and is as follows:
value | description |
---|---|
0 | OFF |
1 | ON |
<?php
include "/lib/sd_spc.php";
spc_reset();
spc_sync_baud(115200);
$sid = 1;
// get status of input ports
echo "Port 0: ", spc_request_dev($sid, "get 0 input"), "\r\n";
echo "Port 1: ", spc_request_dev($sid, "get 1 input"), "\r\n";
echo "Port 2: ", spc_request_dev($sid, "get 2 input"), "\r\n";
echo "Port 3: ", spc_request_dev($sid, "get 3 input"), "\r\n";
?>
Port 0: 0
Port 1: 1
Port 2: 0
Port 3: 1