Since | Origin / Contributor | Maintainer | Source |
---|---|---|---|
2016-02-14 | Henk Vergonet | Henk Vergonet | am2320.c |
This module provides access to the AM2320 humidity and temperature sensor, using the i2c interface.
Initializes the module and sets the pin configuration. Returns model, version, serial but is seams these where all zero on my model.
!!! attention
This function is deprecated and will be removed in upcoming releases. Use `am2320.setup()` instead.
model, version, serial = am2320.init(sda, scl)
sda
data pinscl
clock pinmodel
16 bits number of modelversion
8 bits version numberserial
32 bits serial numberNote: I have only observed values of 0 for all of these, maybe other sensors return more sensible readings.
Samples the sensor and returns the relative humidity in % and temperature in celsius, as an integer multiplied with 10.
am2320.read()
relative humidity
percentage multiplied with 10 (integer)temperature
in celcius multiplied with 10 (integer)sda, scl = 1, 2
i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once
am2320.setup()
rh, t = am2320.read()
print(string.format("RH: %s%%", rh / 10))
print(string.format("Temperature: %s degrees C", t / 10))
Initializes the module. Returns model, version, serial but is seams these where all zero on my model.
model, version, serial = am2320.setup()
None
model
16 bits number of modelversion
8 bits version numberserial
32 bits serial numberNote: I have only observed values of 0 for all of these, maybe other sensors return more sensible readings.