File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 2020while True :
2121 if (time .time ()) >= last + MESSAGE_RATE :
2222 lo .add_to_payload ("distance" , sensor .range )
23- lo .add_to_payload ("ambient_light" , sensor .read_lux ( 0x06 ))
23+ lo .add_to_payload ("ambient_light" , sensor .amb_light ( ))
2424 lo .send_data () # Sending data to cloud
2525 last = time .time ()
2626 lo .loop () # Check for incoming messages and if connection is still active
Original file line number Diff line number Diff line change @@ -260,8 +260,14 @@ def __new__(cls):
260260 import busio
261261 import adafruit_vl6180x
262262 import board
263+
264+ class VL6180X (adafruit_vl6180x .VL6180X ):
265+ def amb_light (self ):
266+ """Implementing default gain"""
267+ return self .read_lux (gain = 0x06 ) # ALS_GAIN_1
268+
263269 i2c = busio .I2C (board .SCL , board .SDA )
264- return adafruit_vl6180x . VL6180X (i2c )
270+ return VL6180X (i2c )
265271
266272 except ImportError : # microPython
267273 import vl6180x_micro
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ def _read_range_single(self):
110110 def range (self ):
111111 return self ._read_range_single ()
112112
113- def read_lux (self , gain = 0x06 ):
113+ def amb_light (self , gain = 0x06 ):
114114 """Read the lux (light value) from the sensor and return it. Must
115115 specify the gain value to use for the lux reading:
116116
You can’t perform that action at this time.
0 commit comments