Simple test

Ensure your device works with this simple test.

examples/veml6070_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4# VEML6070 Driver Example Code
 5
 6import time
 7import board
 8import adafruit_veml6070
 9
10with board.I2C() as i2c:
11    uv = adafruit_veml6070.VEML6070(i2c)
12    # Alternative constructors with parameters
13    # uv = adafruit_veml6070.VEML6070(i2c, 'VEML6070_1_T')
14    # uv = adafruit_veml6070.VEML6070(i2c, 'VEML6070_HALF_T', True)
15
16    # take 10 readings
17    for j in range(10):
18        uv_raw = uv.uv_raw
19        risk_level = uv.get_index(uv_raw)
20        print("Reading: {0} | Risk Level: {1}".format(uv_raw, risk_level))
21        time.sleep(1)