Announcement

Collapse
No announcement yet.

PHPoC Expansion Board issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHPoC Expansion Board issue

    I tried running the sample code provided oin the PSP Library Reference under spc_request() and I get the error PHP error: undefined offset '1' in file relay.php on line 20. Can anyone provide any insight as to why I'm getting this error? I'm using a Blue P4S-342 with the PES-2401N relay board.

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

    spc_reset();
    spc_sync_baud();

    spc_scan();

    $sid = 1;

    function eio_in($sid, $pin)
    {
    $resp = spc_request($sid, 4, "get $pin input");

    if($resp === false)
    return "";

    $resp = explode(",", $resp);

    return $resp[1];
    }

    while(1)
    {
    echo eio_in($sid, 0);
    echo eio_in($sid, 1);
    echo eio_in($sid, 2);
    echo eio_in($sid, 3);
    echo "\r\n";

    sleep(1);
    }
    ?>‚Äč

  • #2
    Hello,
    Did you set the slave id on the relay board to the value on the code? or vice versa ?
    For slave ID on the board, you can see here: https://www.phpoc.com/support/manual....php?id=layout

    Comment

    Working...
    X