phpoc_man
Published © GPL3+

PHPoC - Motion Sensor HC SR501

When a person approaches, turn on the warning light and horn,

BeginnerShowcase (no instructions)673

Things used in this project

Story

Read more

Schematics

wiring_raRA5AHtGs.jpg

Code

task0.php

PHP
<?php

include_once "/lib/sd_340.php";
include_once "/lib/sd_spc.php";

spc_reset();
spc_sync_baud(115200);
spc_request_dev(1, "set 0 output low");

uio_setup(0, 11, "in");


while(1)
{
	$in_value = (int)uio_in(0, 11);
	
	if($in_value)
		spc_request_dev(1, "set 0 output high");
	else
		spc_request_dev(1, "set 0 output low"); 
}
?>

Credits

phpoc_man

phpoc_man

62 projects • 407 followers

Comments