PHP code example of erikwang2013 / industrial-protocols-dali

1. Go to this page and download the library: Download erikwang2013/industrial-protocols-dali library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

erikwang2013 / industrial-protocols-dali example snippets


$bridge = new TcpGatewayBridge('192.168.1.200', 502);
$conn = $kernel->getConnectionManager()->connect('dali-gw', [
    'protocol' => 'dali', 'bridge' => $bridge,
]);
$conn->write(['0x00' => 254]);  // 广播 100% 调光
$conn->write(['0x01' => 128]);  // 灯具 1 50% 调光
$conn->read('0x01');            // 读取灯具 1 状态