Top > 日記 > 2011-08-24

**温湿度計 [#g72b3407]
#ref(th01php.JPG,right,around,30%)
デスクトップ右隅に表示(自動アップデート)させたところ。
+表示までのフロー
温度湿度データ→シリアル通信→PC(Win7)→samba(このホスト)→PHPのfile()使用
 <html>
 <head>
 <meta http-equiv="refresh" content="20">
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <title>Temp&Hum Now</title>
 </head>
 <body>
 <?
 print "<b>今の温度と湿度</b><br>";
 $dt = new DateTime();
 // Asia/Tokyo
 print $dt->setTimeZone(new DateTimeZone('Asia/Tokyo'))    ->format('Y-m-d H:i') . " (JST)<br>";
 $lines = file('/home/share/rcv1.txt');
 print "温度:<b>".substr($lines[0],0,2)."</b> ℃"."<br>";
 print "湿度:<b>".substr($lines[0],3,2)."</b> %"."<br>";
 print "温度:<b>".substr($lines[0],0,2)."</b>&nbsp;℃<br>";
 print "湿度:<b>".substr($lines[0],3,2)."</b>&nbsp;%<br>";
 // Europe/Berlin
 print $dt->setTimeZone(new DateTimeZone('Europe/Berlin'))    ->format('Y-m-d H:i') . " Berlin<br>";
 print $dt->setTimeZone(new DateTimeZone('Europe/Berlin')) ->format('Y-m-d H:i') . " Berlin<br>";
 ?>
 </body>
 </html>

#clear
#comment
#navi(日記)

リロード   新規 下位ページ作成 凍結解除 差分 コピー 名前変更   ホーム 一覧 検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS