—
1 2 3 4 5 6 7 8 9 10 11 12 |
--============================================================ --接线方法:sda接D1 scl接D2 代码: sda,scl = 1,2 --接线方法:sda接d5 scl接d6 代码: sda, scl = 5, 6 --============================================================ 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)) print(string.format("Temperature: %s degrees C", t)) --========================================================== |