【发布时间】:2019-05-15 14:35:58
【问题描述】:
我试图用我的树莓派地址读取我的 DS18B20 传感器温度,我在 /var/www/html/index.php 中编写了这段代码
<?php
// Fichier à lire
$file = "/sys/bus/w1/devices/28-80000026ddb1/w1_slave";
// Lecture ligne par ligne
$lines = file($file);
// Recupere la 2nd ligne
$temp = explode(’=’, $lines[1]);
// Formatage de la temperature
$temp = number_format($temp[1]/1000,2, ’.’, ’’);
// On affiche la temperature
echo $temp;echo" degrés Celius";
?>
它有什么问题?它向我展示了以下内容:
【问题讨论】:
-
您能进一步解释一下吗?这段代码应该有什么问题?
标签: php apache raspberry-pi sensors