Running Micropython on Pi Pico and attempting to use the VEML7700 connected to a TCA9548a on Channel 0. Platform_Detector and Blinka src files are installed. Other adafruit libraries are working fine. As you can see in the output below my VEML6070 is communicating on channel 1 without issues.
import sys import time import board import busio import adafruit_tca9548a import adafruit_veml7700 import adafruit_veml6070 # Setting Sampling Frequency sample_half_sec = time.ticks_ms() sample_sec = time.ticks_ms() i2c = busio.I2C(board.GP5, board.GP4, frequency=400000) tca = adafruit_tca9548a.TCA9548A(i2c) for channel in range(8): if tca[channel].try_lock(): print("Channel {}:".format(channel), end="") addresses = tca[channel].scan() print([hex(address) for address in addresses if address != 0x70]) tca[channel].unlock() # UV SENSOR uv = adafruit_veml6070.VEML6070(tca[1]) # Alternative constructors with parameters # uv = adafruit_veml6070.VEML6070(tca[1], 'VEML6070_1_T') # uv = adafruit_veml6070.VEML6070(tca[1], 'VEML6070_HALF_T', True) def UV_DATA(): uv_raw = uv.uv_raw risk_level = uv.get_index(uv_raw) print("Reading: {0} | Risk Level: {1}".format(uv_raw, risk_level)) # LUX SENSOR luxsensor = adafruit_veml7700.VEML7700(tca[0]) print("Light Integration Time:", luxsensor.light_integration_time) print("Ambient Light:", luxsensor.lux) def LUX_DATA(): print("Ambient Light:", luxsensor.lux) while True: if (time.ticks_ms() - sample_half_sec > 500): sample_half_sec = time.ticks_ms() if (time.ticks_ms() - sample_sec > 1000): UV_DATA() LUX_DATA() sample_sec = time.ticks_ms()
REPL OUTPUT:
MicroPython v1.18 on 2022-01-17; Raspberry Pi Pico with RP2040
Type "help()" for more information.
%Run -c $EDITOR_CONTENT
Channel 0:['0x10']
Channel 1:['0x38', '0x39']
Channel 2:['0x77']
Channel 3:[]
Channel 4:['0x61']
Channel 5:[]
Channel 6:[]
Channel 7:[]
Reading: 0 | Risk Level: LOW
Traceback (most recent call last):
File "", line 35, in
File "/lib/adafruit_veml7700.py", line 197, in init
RuntimeError: Unable to enable VEML7700 device
I've flashed the same Pico with CircuitPython and the sensor works properly with the same library.