PHP code example of unreal4u / ds18b20-sensor-read
1. Go to this page and download the library: Download unreal4u/ds18b20-sensor-read 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/ */
unreal4u / ds18b20-sensor-read example snippets
// Filename: app/ProductionConfig.php
declare(strict_types=1);
use unreal4u\DS18B20Sensor\Configuration\BaseConfig;
class ProductionConfig extends BaseConfig {
public function getMQTTCredentials(): array
{
return array_merge(parent::getMQTTCredentials(), [
'clientId' => 'sensorWriter', // Which clientId this client will pass on to the broker
'host' => '192.168.1.45', // The host of the broker
'user' => 'XXXXXXXX', // Optional username
'pass' => 'YYYYYYYY', // Optional password
]);
}
}
// Filename: app/run.php
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use unreal4u\DS18B20Sensor\Base;
chdir(__DIR__ . '/../');
/stdout', Logger::DEBUG));
$baseProgram = new Base(new ProductionConfig(), $logger);
$baseProgram->runProgram();
$logger->info('Program finished running');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.