Simple test¶
Ensure your device works with this simple test.
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
10i2c = board.I2C() # uses board.SCL and board.SDA
11# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
12
13uv = adafruit_veml6070.VEML6070(i2c)
14# Alternative constructors with parameters
15# uv = adafruit_veml6070.VEML6070(i2c, 'VEML6070_1_T')
16# uv = adafruit_veml6070.VEML6070(i2c, 'VEML6070_HALF_T', True)
17
18# take 10 readings
19for j in range(10):
20 uv_raw = uv.uv_raw
21 risk_level = uv.get_index(uv_raw)
22 print("Reading: {0} | Risk Level: {1}".format(uv_raw, risk_level))
23 time.sleep(1)