-
Notifications
You must be signed in to change notification settings - Fork 13
ENV.Ⅱ(SHT30, BMP280)
Nishikori Koji edited this page Feb 24, 2022
·
1 revision
サンプルコード: https://github.com/gfd-dennou-club/iotex-esp32-mrubyc/blob/master/example/master.rb.env2
温度/湿度センサ
コードURL: https://github.com/gfd-dennou-club/iotex-esp32-mrubyc/blob/master/mrblib/models/sht3x.rb
SHT3X.new(i2c)
- i2c : I2Cクラスのオブジェクト
example
i2c = I2C.new(22, 21)
sht3x = SHT3X.new(i2c)
SHT3X.readTemperature()
example
temp = sht3x.readTemperature
SHT3X.readHumidity()
example
humi = sht3x.readHumidity
温度/気圧センサ
コードURL: https://github.com/gfd-dennou-club/iotex-esp32-mrubyc/blob/master/mrblib/models/bmp280.rb
BMP280.new(i2c)
- i2c : I2Cクラスのオブジェクト
example
i2c = I2C.new(22, 21)
bmp280 = BMP280.new(i2c)
BMP280.readTemperature()
example
temp = bmp280.readTemperature
BMP280.readPressure()
example
pa = bmp280.readPressure