diff --git a/test/test_load_sensors.py b/test/test_load_sensors.py index a3a5572..8ad0958 100644 --- a/test/test_load_sensors.py +++ b/test/test_load_sensors.py @@ -7,9 +7,19 @@ from tentacle_pi.MPL115A2 import MPL115A2 from tentacle_pi.LM75 import LM75 +""" +Simple test to check if all supported sensors are working. + +- Runs on a Odroid C1 (Ubuntu) and Raspberry Pi 1 / 2 (Raspbian). +- For the Banana Pi (Raspbian) change the variable I2C_DEVICE to '/dev/i2c-2' + +""" + +I2C_DEVICE = '/dev/i2c-1' + print "test AM2315" -am = AM2315(0x5c,"/dev/i2c-1") +am = AM2315(0x5c, I2C_DEVICE) temperature, humidity, crc_check = am.sense() print "temperature: %0.1f" % temperature print "humidity: %0.1f" % humidity @@ -19,7 +29,7 @@ print "test BMP180" -bmp = BMP180(0x77,"/dev/i2c-1") +bmp = BMP180(0x77, I2C_DEVICE) print "temperature: %0.1f" % bmp.temperature() print "pressure: %s" % bmp.pressure() print "altitude: %0.1f" % bmp.altitude() @@ -28,7 +38,7 @@ print "test TSL2561" -tsl = TSL2561(0x39,"/dev/i2c-1") +tsl = TSL2561(0x39, I2C_DEVICE) tsl.enable_autogain() tsl.set_time(0x00) print "lux %s" % tsl.lux() @@ -37,7 +47,7 @@ print "test MCP9808" -mcp = MCP9808(0x18,"/dev/i2c-1") +mcp = MCP9808(0x18, I2C_DEVICE) temperature = mcp.temperature() print "temperature: %0.2f" % temperature print @@ -45,7 +55,7 @@ print "test MPL115A2" -mpl = MPL115A2(0x60,"/dev/i2c-1") +mpl = MPL115A2(0x60, I2C_DEVICE) temperature, pressure = mpl.temperature(), mpl.pressure() print "temperature: %0.1f" % temperature print "pressure: %0.1f" % pressure @@ -54,7 +64,7 @@ print "test LM75" -lm = LM75(0x48,"/dev/i2c-1") +lm = LM75(0x48, I2C_DEVICE) temperature = lm.temperature() print "temperature: %0.2f" % temperature time.sleep(2)