Skip to content

Commit c3428ff

Browse files
committed
0.2.8 BH1750FVI_RT
1 parent a2c30ce commit c3428ff

File tree

18 files changed

+92
-31
lines changed

18 files changed

+92
-31
lines changed

libraries/BH1750FVI_RT/.arduino-ci.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ compile:
22
# Choosing to run compilation tests on 2 different Arduino platforms
33
platforms:
44
- uno
5-
- leonardo
6-
- due
7-
- zero
5+
# - due
6+
# - zero
7+
# - leonardo
8+
- m4
9+
- esp32
10+
# - esp8266
11+
# - mega2560

libraries/BH1750FVI_RT/.github/workflows/arduino_test_runner.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ name: Arduino CI
44
on: [push, pull_request]
55

66
jobs:
7-
arduino_ci:
7+
runTest:
88
runs-on: ubuntu-latest
99

1010
steps:
1111
- uses: actions/checkout@v2
12-
- uses: Arduino-CI/action@master
13-
# Arduino-CI/[email protected]
12+
- uses: ruby/setup-ruby@v1
13+
with:
14+
ruby-version: 2.6
15+
- run: |
16+
gem install arduino_ci
17+
arduino_ci.rb

libraries/BH1750FVI_RT/BH1750FVI.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
//
22
// FILE: BH1750FVI.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.2.7
4+
// VERSION: 0.2.8
55
// PURPOSE: library for BH1750FVI lux sensor Arduino
66
// URL: https://github.com/RobTillaart/BH1750FVI
77
//
8+
// HISTORY
89
// 0.1.0 2020-02-02 initial version
910
// 0.1.1 2020-03-28 refactor
1011
// 0.1.2 2020-03-29 unique name in repo, and new release tag.
1112
// 0.1.3 2020-06-05 fix library.json file
12-
// 0.1.4 2020-08-14 cleanup tabs/spaces;
13+
// 0.1.4 2020-08-14 clean up tabs/spaces;
1314
// 0.2.0 2020-08-18 implement logic for LOW & HIGH2;
14-
// implement correctionfactor; examples;
15+
// implement correction factor; examples;
1516
// 0.2.1 2020-08-31 implement angle factor
1617
// 0.2.2 2020-09-04 implement temperature compensation
1718
// 0.2.3 2020-09-04 implement wavelength compensation
1819
// 0.2.4 2020-11-27 fix #10 rename _sensitivityFactor for ESP32
1920
// 0.2.5 2020-12-12 add Arduino-CI and unit tests
2021
// 0.2.6 2021-01-16 add reset()
21-
// 0.2.7 2021-06-08 add unit tests, improved correction factor code.
22+
// 0.2.7 2021-06-08 add unit tests, improved correction factor code
23+
// 0.2.8 2021-10-19 update Arduino-CI, badges in readme
2224

2325

2426
#include "BH1750FVI.h"
@@ -274,4 +276,6 @@ void BH1750FVI::command(uint8_t value)
274276
_error = _wire->endTransmission();
275277
}
276278

279+
277280
// --- END OF FILE ---
281+

libraries/BH1750FVI_RT/BH1750FVI.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// FILE: BH1750FVI.h
44
// AUTHOR: Rob dot Tillaart at gmail dot com
5-
// VERSION: 0.2.7
5+
// VERSION: 0.2.8
66
// PURPOSE: Arduino library for BH1750FVI (GY-30) lux sensor
77
// HISTORY: See BH1750FVI.cpp
88
//
@@ -28,7 +28,7 @@
2828
#include "Arduino.h"
2929

3030

31-
#define BH1750FVI_LIB_VERSION (F("0.2.7"))
31+
#define BH1750FVI_LIB_VERSION (F("0.2.8"))
3232

3333

3434
#define BH1750FVI_DEFAULT_ADDRESS 0x23

libraries/BH1750FVI_RT/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
[![Arduino CI](https://github.com/RobTillaart/BH1750FVI_RT/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
3+
[![Arduino-lint](https://github.com/RobTillaart/BH1750FVI_RT/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/BH1750FVI_RT/actions/workflows/arduino-lint.yml)
4+
[![JSON check](https://github.com/RobTillaart/BH1750FVI_RT/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/BH1750FVI_RT/actions/workflows/jsoncheck.yml)
35
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/BH1750FVI_RT/blob/master/LICENSE)
46
[![GitHub release](https://img.shields.io/github/release/RobTillaart/BH1750FVI_RT.svg?maxAge=3600)](https://github.com/RobTillaart/BH1750FVI_RT/releases)
57

@@ -60,8 +62,8 @@ The sensor works on 2.4 - 3.6 volt so be careful not to connect directly to 5.0
6062

6163
### Constructor
6264

63-
- **BH1750FVI(address, dataPin, clockPin)** ESP constructor with I2C parameters
64-
- **BH1750FVI(address, TwoWire \*wire = &Wire)** constructor for other platforms
65+
- **BH1750FVI(uint8_t address, uint8_t dataPin, uint8_t clockPin)** ESP constructor with I2C parameters
66+
- **BH1750FVI(uint8_t address, TwoWire \*wire = &Wire)** constructor for other platforms
6567
- **bool begin()** resets some internal variables to default. Use with care.
6668
- **bool isConnected()** returns true if address is on I2C bus.
6769

@@ -112,7 +114,7 @@ Note: experimental - use carefully
112114

113115
The lux sensor is really sensitive for the angle of the light.
114116
If one makes measurements outside, the position of the sun changes
115-
during the day. The **setAngle(degrees)** function provides a mean to correct that.
117+
during the day. The **setAngle(int degrees)** function provides a mean to correct that.
116118

117119
The angle adjustments is based upon the figure 4 and 5 (directional characteristics.)
118120
which describe **Lambert’s Cosine Law**. (details see Wikipedia)
@@ -124,7 +126,7 @@ If the light is perpendicular on the sensor the angle to use is 0 degrees.
124126
Light coming from the side is 90 degrees.
125127

126128
- **float setAngle(int degrees = 0)** adjust the lux to incoming angle in degrees (-89..89). Returns the angle correction factor.
127-
- **int getAngle()** returns set angle in degrees, 0 by default is perpendicular
129+
- **int getAngle()** returns set angle in degrees, 0 by default is perpendicular.
128130

129131

130132
### Temperature Compensation
@@ -134,7 +136,7 @@ The effect of temperature is small, about 3% per 60°C ==> 1% per 20°C
134136
so only on either a hot roof or on a icy cold day the effect is substantial.
135137

136138
- **float setTemperature(int temp = 20)** see datasheet P3 fig7 Returns the temperature correction factor
137-
- **int getTemperature()** returns temperature set, default = 20°C
139+
- **int getTemperature()** returns temperature set, default = 20°C.
138140

139141

140142
### Spectral Compensation ! EXPERIMENTAL !

libraries/BH1750FVI_RT/examples/BH1750FVI_angle_measurement/BH1750FVI_angle_measurement.ino

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
Lux level compared to the references.
2323
2424
First trials are not not too bad, roughly within 15° accuracy
25-
2625
*/
2726

27+
2828
#include "BH1750FVI.h"
2929

3030
BH1750FVI myLux(0x23);
@@ -71,6 +71,7 @@ void setup()
7171
Serial.println(ref2);
7272
}
7373

74+
7475
void loop()
7576
{
7677
float val = measure(1, false);
@@ -91,4 +92,6 @@ void loop()
9192
Serial.println();
9293
}
9394

95+
9496
// -- END OF FILE --
97+

libraries/BH1750FVI_RT/examples/BH1750FVI_async/BH1750FVI_async.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
// DATE: 2020-08-20
77
//
88

9+
910
#include "BH1750FVI.h"
1011

1112
BH1750FVI myLux(0x23);
1213

1314
float correctionFactor = 0.45; // min value see datasheet
1415
uint32_t count = 0;
1516

17+
1618
void setup()
1719
{
1820
Serial.begin(115200);
@@ -26,6 +28,7 @@ void setup()
2628
myLux.setContHighRes();
2729
}
2830

31+
2932
void loop()
3033
{
3134
if (myLux.isReady())
@@ -47,7 +50,7 @@ void loop()
4750
Serial.print("\t");
4851
Serial.println(val / myLux.getCorrectionFactor(), 1);
4952

50-
// note correctionfactor are steps of 1/69 internally, see datasheet
53+
// note correction factor are steps of 1/69 internally, see datasheet
5154
correctionFactor += 0.05;
5255
if (correctionFactor > 3.68) // 0.45 - 3.68 = 45 steps of 0.05
5356
{
@@ -62,4 +65,6 @@ void loop()
6265
// do other things here
6366
}
6467

68+
6569
// -- END OF FILE --
70+

libraries/BH1750FVI_RT/examples/BH1750FVI_cont_high_res/BH1750FVI_cont_high_res.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// using mylux.getRaw() instead of myLux.getLux(); line38
1010
// gain on UNO: ~350 bytes smaller
1111

12+
1213
#include "BH1750FVI.h"
1314

1415
BH1750FVI myLux(0x23);
@@ -29,6 +30,7 @@ void setup()
2930
myLux.setContHighRes();
3031
}
3132

33+
3234
void loop()
3335
{
3436
uint16_t interval = 100;
@@ -41,4 +43,5 @@ void loop()
4143

4244
}
4345

46+
4447
// -- END OF FILE --

libraries/BH1750FVI_RT/examples/BH1750FVI_cont_low_res/BH1750FVI_cont_low_res.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
// PURPOSE: demo of BH1750FVI lux scanner library
66
// DATE: 2020-02-02
77
//
8-
// Released to the public domain
9-
//
8+
109

1110
#include "BH1750FVI.h"
1211

@@ -28,6 +27,7 @@ void setup()
2827
myLux.setContLowRes();
2928
}
3029

30+
3131
void loop()
3232
{
3333
uint16_t interval = 100;
@@ -40,4 +40,6 @@ void loop()
4040

4141
}
4242

43-
// END OF FILE
43+
44+
// -- END OF FILE --
45+

libraries/BH1750FVI_RT/examples/BH1750FVI_setAngle/BH1750FVI_setAngle.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
// DATE: 2020-08-31
77
//
88

9+
910
#include "BH1750FVI.h"
1011

1112
BH1750FVI myLux(0x23);
1213

14+
1315
void setup()
1416
{
1517
Serial.begin(115200);
@@ -23,6 +25,7 @@ void setup()
2325
myLux.setContHighRes();
2426
}
2527

28+
2629
void loop()
2730
{
2831
for (int x = -90; x < 90; x += 1)
@@ -40,4 +43,6 @@ void loop()
4043
Serial.println();
4144
}
4245

46+
4347
// -- END OF FILE --
48+

0 commit comments

Comments
 (0)