2021-01-29 06:31:58 -05:00
|
|
|
//
|
|
|
|
// FILE: BH1750FVI_setAngle.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo of BH1750FVI lux scanner library
|
|
|
|
// DATE: 2020-08-31
|
|
|
|
|
2021-10-19 10:54:37 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
#include "BH1750FVI.h"
|
|
|
|
|
|
|
|
BH1750FVI myLux(0x23);
|
|
|
|
|
2021-10-19 10:54:37 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println();
|
|
|
|
Serial.print(__FILE__);
|
|
|
|
Serial.println();
|
|
|
|
|
|
|
|
Wire.begin();
|
|
|
|
|
|
|
|
myLux.powerOn();
|
|
|
|
myLux.setContHighRes();
|
|
|
|
}
|
|
|
|
|
2021-10-19 10:54:37 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
for (int x = -90; x < 90; x += 1)
|
|
|
|
{
|
|
|
|
myLux.setAngle(x);
|
|
|
|
float val = myLux.getLux();
|
|
|
|
|
|
|
|
Serial.print(val, 1);
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(myLux.getAngle());
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.println();
|
|
|
|
delay(20);
|
|
|
|
}
|
|
|
|
Serial.println();
|
|
|
|
}
|
|
|
|
|
2021-10-19 10:54:37 -04:00
|
|
|
|
2023-10-18 10:41:42 -04:00
|
|
|
// -- END OF FILE --
|