LAN DS18B20 WEB Temperature Monitor 1 meter Cable
www.WEB-Relays.com
www.Facebook.com/KMtronic

USB Relay Module for Windows, Linux, Raspberry Pi

Spread the love




include ‘PhpSerial.php’;

// Let’s start the class
$serial = new PhpSerial;

// First we must specify the device. This works on both Linux and Windows
// (if your linux serial device is /dev/ttyS0 for COM1, etc)
$serial->deviceSet(“/dev/ttyUSB0“);

// We can change the baud rate, parity, length, stop bits, flow control
$serial->confBaudRate(9600);
$serial->confParity(“none”);
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl(“none”);

// Then we need to open it
$serial->deviceOpen();

// To write into ON command
$serial->sendMessage(“\xFF\x01\x01“);

sleep(1);

// To write into OFF comand
$serial->sendMessage(“\xFF\x01\x00“);

// If you want to change the configuration, the device must be closed
$serial->deviceClose();




KMtronic LAN WEB 8 Channel Relay board