Skip to content

Latest commit

 

History

History
74 lines (53 loc) · 2.73 KB

README.md

File metadata and controls

74 lines (53 loc) · 2.73 KB

Quality Gate Status Maintainability Rating

Lines of Code Duplicated Lines (%)

Reliability Rating Security Rating Vulnerabilities

Upload Python Package Python package

GreenPonik_BH1750.py Library for Raspberry pi


This is the sample code for read light with BH1750 sensor.

Table of Contents

Installation

> git clone https://github.com/GreenPonik/GreenPonik_BH1750.git
cd GreenPonik_BH1750
pip3 install -r requirements.txt

or 

> pip3 install greenponik-bh1750
from GreenPonik_BH1750.BH1750 import BH1750

Methods

"""
Get light data
"""
def read_bh1750():

Example

import time
from GreenPonik_BH1750.BH1750 import BH1750

if __name__ == "__main__":
    try:
        bh = BH1750()
        while True:
            lux = bh.read_bh1750()
            print(lux)
            time.sleep(1)
    except Exception as e:
        print('An exception occurred: {}'.format(e))

Credits

Write by Mickael Lehoux, from GreenPonik, 2019