ユーザ用ツール

サイト用ツール


raspi_iot:統合テスト

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
raspi_iot:統合テスト [2019/03/30 16:42] hirohitoraspi_iot:統合テスト [2021/07/05 11:15] (現在) – [プログラム全体] hirohito
行 36: 行 36:
 require "uri" require "uri"
 require "json" require "json"
 +...
 POST_URI = "http://192.168.1.11/cgi-bin/index.rb?ctrl=data_post" POST_URI = "http://192.168.1.11/cgi-bin/index.rb?ctrl=data_post"
   ...   ...
行 41: 行 42:
     AlWorker.log( data )     AlWorker.log( data )
  
-    Net::HTTP.post_form(URI.parse(POST_URI),{"data"=>data.to_json})+    Net::HTTP.post_form(URI.parse(POST_URI), {"data"=>data.to_json})
   end   end
 </code> </code>
行 138: 行 139:
     ret = {}     ret = {}
     buf = @i2c.read(ADRS, 5, 0xa8)     buf = @i2c.read(ADRS, 5, 0xa8)
-    p_cnt = to_uint24(buf[2].ord, buf[1].ord, buf[0].ord)+    p_cnt = to_uint24(buf.getbyte(2), buf.getbyte(1), buf.getbyte(0))
     ret[:pressure] = p_cnt.to_f / 4096     ret[:pressure] = p_cnt.to_f / 4096
  
-    t_cnt = to_int16(buf[4].ord, buf[3].ord)+    t_cnt = to_int16(buf.getbyte(4), buf.getbyte(3))
     ret[:temperature] = 42.5 + t_cnt.to_f / 480     ret[:temperature] = 42.5 + t_cnt.to_f / 480
  
行 150: 行 151:
     AlWorker.log( data )     AlWorker.log( data )
  
-    uri = "http://192.168.1.11/cgi-bin/index.rb?ctrl=data_post" 
     Net::HTTP.post_form(URI.parse(POST_URI), {"data"=>data.to_json})     Net::HTTP.post_form(URI.parse(POST_URI), {"data"=>data.to_json})
   end   end
raspi_iot/統合テスト.txt · 最終更新: 2021/07/05 11:15 by hirohito