Stop manually


A command stop can be used to manually stop the stepper motor operation when the limit switch is closed.

At this time, a command eio get is used to detect the input of the limit switch.

<?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");
?>