Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Usage Example

# take 10 readings
for j in range(10):
uv_raw = uv.read
uv_raw = uv.raw_uv
risk_level = uv.get_index(uv_raw)
print('Reading: {0} | Risk Level: {1}'.format(uv_raw, risk_level))
time.sleep(1)
Expand Down
16 changes: 8 additions & 8 deletions adafruit_veml6070.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class VEML6070:

# take 10 readings
for j in range(10):
uv_raw = uv.read
uv_raw = uv.raw_uv
risk_level = uv.get_index(uv_raw)
print('Reading: ', uv_raw, ' | Risk Level: ', risk_level)
time.sleep(1)
Expand Down Expand Up @@ -145,18 +145,18 @@ def __init__(self, i2c_bus, _veml6070_it="VEML6070_1_T", ack=False):


@property
def read(self):
def raw_uv(self):
"""
Reads and returns the value of the UV intensity.
"""
read_buf = bytearray(2)
uv_buf = bytearray(2)
with self.i2c_low as i2c_low:
i2c_low.readinto(read_buf, end=1)
i2c_low.readinto(uv_buf, end=1)

with self.i2c_high as i2c_high:
i2c_high.readinto(read_buf, start=1)
i2c_high.readinto(uv_buf, start=1)

uvi = read_buf[1] << 8 | read_buf[0]
uvi = uv_buf[1] << 8 | uv_buf[0]

return uvi

Expand Down Expand Up @@ -231,7 +231,7 @@ def sleep(self):

def wake(self):
"""
Wakes the VEML6070 from sleep. ``[veml6070].read`` will also wake from sleep.
Wakes the VEML6070 from sleep. ``[veml6070].raw_uv`` will also wake from sleep.
"""
self.buf[0] = (self._ack << 5 | self._ack_thd << 4 |
_VEML6070_INTEGRATION_TIME[self._it][0] << 2 | 0x02)
Expand All @@ -241,7 +241,7 @@ def wake(self):
def get_index(self, _raw):
"""
Calculates the UV Risk Level based on the captured UV reading. Requres the ``_raw``
argument (from ``veml6070.read``). Risk level is available for Integration Times (IT)
argument (from ``veml6070.raw_uv``). Risk level is available for Integration Times (IT)
1, 2, & 4. The result is automatically scaled to the current IT setting.

LEVEL* UV Index
Expand Down
2 changes: 1 addition & 1 deletion examples/veml6070_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# take 10 readings
for j in range(10):
uv_raw = uv.read
uv_raw = uv.raw_uv
risk_level = uv.get_index(uv_raw)
print('Reading: {0} | Risk Level: {1}'.format(uv_raw, risk_level))
time.sleep(1)