**温湿度計 [#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>"; // Europe/Berlin print $dt->setTimeZone(new DateTimeZone('Europe/Berlin')) ->format('Y-m-d H:i') . " Berlin<br>"; ?> </body> </html> #clear #comment #navi(日記) |