Package com.diozero.devices
Class BH1750
- java.lang.Object
-
- com.diozero.devices.BH1750
-
- All Implemented Interfaces:
DeviceInterface
,LuminositySensorInterface
,SensorInterface
,AutoCloseable
public class BH1750 extends Object implements LuminositySensorInterface
BH1750 Luminosity sensor Datasheet Python code Pins:+------------------------------+ | BH1750 | |------+-----+-----+-----+-----| | ADDR | SDA | SCL | GND | VCC | +------+-----+-----+-----+-----+
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BH1750.Mode
-
Constructor Summary
Constructors Constructor Description BH1750(int controller)
BH1750(int controller, int address)
BH1750(int controller, int address, BH1750.Mode mode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close this devicefloat
getLuminosity()
BH1750.Mode
getMode()
void
reset()
void
setMode(BH1750.Mode mode)
-
-
-
Constructor Detail
-
BH1750
public BH1750(int controller)
-
BH1750
public BH1750(int controller, int address)
-
BH1750
public BH1750(int controller, int address, BH1750.Mode mode)
-
-
Method Detail
-
close
public void close()
Description copied from interface:DeviceInterface
Close this device- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDeviceInterface
-
getMode
public BH1750.Mode getMode()
-
setMode
public void setMode(BH1750.Mode mode)
-
reset
public void reset()
-
getLuminosity
public float getLuminosity() throws RuntimeIOException
- Specified by:
getLuminosity
in interfaceLuminositySensorInterface
- Throws:
RuntimeIOException
-
-