Ingo Lohs
Published © LGPL

PHPoC: Relay-Board PES-2401 R2

How to use a PHPoC-Expansion Board - control up to 4 relays via your browser.

BeginnerProtip1.5 hours522
PHPoC: Relay-Board PES-2401 R2

Things used in this project

Hardware components

PHPoC 4-Port Relay Expansion Board (S-type or T-type)
PHPoC 4-Port Relay Expansion Board (S-type or T-type)
×1
PHPoC Blue
PHPoC Blue
×1
DC Adapter 2,1 x 5,5 mm Adapter
3 cables
×1
Power Supply 12V to control LEDs
×1

Software apps and online services

PHPoC Debugger
PHPoC Debugger

Story

Read more

Code

Relay

PHP
<?php
include "/lib/sd_spc.php";
spc_reset();
spc_sync_baud(115200);
$sid = 1;

// set Port 4 high {named internal Port 0-3}
spc_request_dev($sid, "set 3 output high");
// get status of output ports
echo "Port 3: ", spc_request_dev($sid, "get 3 output"), "\r\n";
sleep(3);

// set Port 4 low {named internal Port 0-3}
spc_request_dev($sid, "set 3 output low");
// get status of output ports
echo "Port 3: ", spc_request_dev($sid, "get 3 output"), "\r\n";

?>

Credits

Ingo Lohs

Ingo Lohs

182 projects • 194 followers
I am well over 50 years and come from the middle of Germany.

Comments