-
Notifications
You must be signed in to change notification settings - Fork 12
TMP007
Nishikori Koji edited this page Feb 24, 2022
·
4 revisions
非接触温度センサ
コードURL: https://github.com/gfd-dennou-club/iotex-esp32-mrubyc/blob/master/mrblib/models/tmp007.rb
サンプルコード: https://github.com/gfd-dennou-club/iotex-esp32-mrubyc/blob/master/example/master.rb.tmp007
TMP007.new(i2c)
- i2c : I2Cクラスのオブジェクト
example
i2c = I2C.new(22, 21)
tmp007 = TMP007.new(i2c)
TMP007.init(samplerate)
- samplerate : サンプルレートの指定(CFG_1SAMPLE、CFG_2SAMPLE、CFG_4SAMPLE、CFG_8SAMPLE、CFG_16SAMPLE)
戻り値はtrue or false
example
if !tmp007.init(TMP007::CFG_16SAMPLE)
puts "No sensor found"
else
...
end
TMP007.read_die_temp_c()
example
diet = tmp007.read_die_temp_c
TMP007.read_obj_temp_c()
example
objt = tmp007.read_obj_temp_c