An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# BH1750

[![Build on Raspberry Pi](https://github.com/endail/BH1750/actions/workflows/buildcheck.yml/badge.svg)](https://github.com/endail/BH1750/actions/workflows/buildcheck.yml) [![cppcheck](https://github.com/endail/BH1750/actions/workflows/cppcheck.yml/badge.svg)](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
```