手动停止


限制开关关闭时利用stop命令可手动停止步进电机的动作。 此时是否输入限制开关利用eio get

<?php
include_once "/lib/sd_spc.php";

spc_reset();
spc_sync_baud(115200);

$sid = 1;
$state = 0;

spc_request_dev($sid, "eio set 0 mode input");

spc_request_dev($sid, "set vref stop 2");
spc_request_dev($sid, "set vref drive 8");
spc_request_dev($sid, "set mode 4");

spc_request_dev($sid, "goto 40000 400 1000");

while(1)
{
    $state = (int)spc_request_dev($sid, "eio get 0 input");
    if($state == 0)
        break;
    usleep(1);
}

spc_request_dev($sid, "stop");
?>