Digital 16bit Serial Output Type Ambient Light Sensor IC by ROHM, Ambient light sensor (Illuminance to digital converter). Forked from Kenji Arai BH1750, minor changes.
BH1750 Class Reference
Interface for Luminosity sensor, BH1750. More...
#include <BH1750.h>
Public Member Functions | |
BH1750 (PinName p_sda, PinName p_scl) | |
Configure data pin. | |
BH1750 (I2C &p_i2c) | |
Configure data pin (with other devices on I2C line) | |
float | lux (void) |
Get Illuminance, unit of Lux. | |
void | set_high_resolution_continuous (uint8_t parameter) |
Set sensor to high resolution mode. | |
void | set_high_resolution2_continuous (uint8_t parameter) |
Set sensor to high resolution mode. | |
void | set_low_resolution_continuous (uint8_t parameter) |
Set I2C clock frequency. | |
void | power_up (void) |
Power Up/Down. |
Detailed Description
Interface for Luminosity sensor, BH1750.
#include "mbed.h" #include "BH1750.h" // I2C Communication BH1750 lum(dp5,dp27); // BH1750 SDA, SCL //If you connected I2C line not only this device but also other devices, //you need to declare following method. //I2C i2c(dp5,dp27); // SDA, SCL //BH1750 lum(i2c); // BH1750 SDA, SCL (Data available every 120mSec) int main() { lum.set_high_resolution(SENS_1R00); //or //lum.set_high_resolution_2(SENS_1R00); while(true){ printf("Illuminance: %+7.2f [Lux]\r\n", lum.lux()); wait(1.0); } } //
Definition at line 77 of file BH1750.h.
Constructor & Destructor Documentation
BH1750 | ( | PinName | p_sda, |
PinName | p_scl | ||
) |
BH1750 | ( | I2C & | p_i2c ) |
Configure data pin (with other devices on I2C line)
- Parameters:
-
I2C previous definition
Definition at line 39 of file BH1750.cpp.
Member Function Documentation
float lux | ( | void | ) |
Get Illuminance, unit of Lux.
- Parameters:
-
none
- Returns:
- Lux
Definition at line 54 of file BH1750.cpp.
void power_up | ( | void | ) |
void set_high_resolution2_continuous | ( | uint8_t | parameter ) |
Set sensor to high resolution mode.
- Parameters:
-
sensitivity parameter
- Returns:
- none
Definition at line 172 of file BH1750.cpp.
void set_high_resolution_continuous | ( | uint8_t | parameter ) |
Set sensor to high resolution mode.
- Parameters:
-
sensitivity parameter
- Returns:
- none
Definition at line 154 of file BH1750.cpp.
void set_low_resolution_continuous | ( | uint8_t | parameter ) |
Generated on Tue Jul 12 2022 23:32:04 by 1.7.2