@@ -105,7 +105,7 @@ class VEML6070:
105
105
106
106
# take 10 readings
107
107
for j in range(10):
108
- uv_raw = uv.read
108
+ uv_raw = uv.uv_raw
109
109
risk_level = uv.get_index(uv_raw)
110
110
print('Reading: ', uv_raw, ' | Risk Level: ', risk_level)
111
111
time.sleep(1)
@@ -145,20 +145,18 @@ def __init__(self, i2c_bus, _veml6070_it="VEML6070_1_T", ack=False):
145
145
146
146
147
147
@property
148
- def read (self ):
148
+ def uv_raw (self ):
149
149
"""
150
150
Reads and returns the value of the UV intensity.
151
151
"""
152
- read_buf = bytearray (2 )
152
+ buffer = bytearray (2 )
153
153
with self .i2c_low as i2c_low :
154
- i2c_low .readinto (read_buf , end = 1 )
154
+ i2c_low .readinto (buffer , end = 1 )
155
155
156
156
with self .i2c_high as i2c_high :
157
- i2c_high .readinto (read_buf , start = 1 )
157
+ i2c_high .readinto (buffer , start = 1 )
158
158
159
- uvi = read_buf [1 ] << 8 | read_buf [0 ]
160
-
161
- return uvi
159
+ return buffer [1 ] << 8 | buffer [0 ]
162
160
163
161
@property
164
162
def ack (self ):
@@ -231,7 +229,7 @@ def sleep(self):
231
229
232
230
def wake (self ):
233
231
"""
234
- Wakes the VEML6070 from sleep. ``[veml6070].read `` will also wake from sleep.
232
+ Wakes the VEML6070 from sleep. ``[veml6070].uv_raw `` will also wake from sleep.
235
233
"""
236
234
self .buf [0 ] = (self ._ack << 5 | self ._ack_thd << 4 |
237
235
_VEML6070_INTEGRATION_TIME [self ._it ][0 ] << 2 | 0x02 )
@@ -241,7 +239,7 @@ def wake(self):
241
239
def get_index (self , _raw ):
242
240
"""
243
241
Calculates the UV Risk Level based on the captured UV reading. Requres the ``_raw``
244
- argument (from ``veml6070.read ``). Risk level is available for Integration Times (IT)
242
+ argument (from ``veml6070.uv_raw ``). Risk level is available for Integration Times (IT)
245
243
1, 2, & 4. The result is automatically scaled to the current IT setting.
246
244
247
245
LEVEL* UV Index
0 commit comments