File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 18
18
# Added calculateAvgLux
19
19
# Changed main method to use calculateAvgLux and looping support added.
20
20
# Ported "Extended delays to take into account loose timing with 'delay'" update from CPP code
21
+ # Added have so that with autogain every sample goes from 1x to 16x as going from 16x to 1x does not work
21
22
#
22
23
23
24
import sys
@@ -141,6 +142,8 @@ class Adafruit_TSL2651(Adafruit_I2C):
141
142
142
143
TSL2561_GAIN_1X = 0x00 # No gain
143
144
TSL2561_GAIN_16X = 0x10 # 16x gain
145
+
146
+ TSL2561_NO_OF_AVG_SAMPLES = 25 # How many samples to make an average reading
144
147
145
148
146
149
@@ -489,7 +492,7 @@ def calculateLux(self):
489
492
#**************************************************************************/
490
493
# Calculates an averaged Lux value over default 30 samples
491
494
#**************************************************************************/
492
- def calculateAvgLux (self , testavg = int ( 30 ) ):
495
+ def calculateAvgLux (self , testavg = self . TSL2561_NO_OF_AVG_SAMPLES ):
493
496
# Set initial vars
494
497
count = 0
495
498
luxavgtotal = 0
You can’t perform that action at this time.
0 commit comments