You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
609 B

#include <Arduino.h>
#include "myi2c.h"
#include "bh1750.h"
//-------------------------------------------------
// Power Up and start Messung
void BH1750_Init(void)
{
// BH1750 = HY30 Licht Sensor
Set_I2C_Adresse(BH1750_ADR); // GY-30 = 0x23
I2C_write8A( 1); // Power On
I2C_write8A( 0x20); // Start 1 lux Wandlung 120ms
delay(180);
}
//-------------------------------------------------
// Raed an Power Down
unsigned int BH1750_ReadLux( void )
{
unsigned int uiLux;
uiLux = I2C_read16A()*10L/12;
I2C_write8A( 0); // Power Down
return( uiLux);
}
//------------------------------------------------