request sending a device command to smart expansion boards
string spc_request_dev(int $sid, string $cmd)
a response string according to each command
<?php
/* This example is for PES-2403 only */
include_once "/lib/sd_spc.php";
spc_reset();
spc_sync_baud();
$sid = 1;
spc_request_dev($sid, "set mode full");
spc_request_dev($sid, "set vref stop 2");
spc_request_dev($sid, "set vref drive 8");
spc_request_dev($sid, "set speed 400");
spc_request_dev($sid, "set accel 800");
spc_request_dev($sid, "set rsnc 120 250");
$state = 0;
spc_request_dev($sid, "move 400");
while($state = (int)spc_request_dev($sid, "get state"))
{
echo "state: $state\r\n";
usleep(200000);
}
echo "state: $state\r\n";
?>