https://github.com/endail/bh1750
BH1750 light sensor API for Raspberry Pi
https://github.com/endail/bh1750
bh1750 cpp lgpio raspberry-pi
Last synced: 8 months ago
JSON representation
BH1750 light sensor API for Raspberry Pi
- Host: GitHub
- URL: https://github.com/endail/bh1750
- Owner: endail
- License: mit
- Created: 2021-04-20T13:49:21.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-10-31T12:51:58.000Z (over 4 years ago)
- Last Synced: 2024-12-28T01:40:10.915Z (over 1 year ago)
- Topics: bh1750, cpp, lgpio, raspberry-pi
- Language: C++
- Homepage:
- Size: 72.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BH1750
[](https://github.com/endail/BH1750/actions/workflows/buildcheck.yml) [](https://github.com/endail/BH1750/actions/workflows/cppcheck.yml)
- Use with Raspberry Pi
- Requires [lgpio](http://abyz.me.uk/lg/index.html)
- Code tested inside [virtual Raspberry Pi Zero/3/4 environments](.github/workflows/buildcheck.yml) on GitHub
## Example
```cpp
#include "BH1750.h"
#include
int main() {
BH1750::BH1750 sensor;
sensor.connect();
std::cout << sensor.lux() << std::endl;
return 0;
}
```
## Use
After writing your own code (eg. main.cpp), compile and link with the lgpio library as follows:
```console
pi@raspberrypi:~ $ g++ -Wall -o prog main.cpp -llgpio
```