# Veml6075 MicroPython driver?

**URL:** <https://forums.pimoroni.com/t/veml6075-micropython-driver/18906>\
**Category:** Support\
**Created:** [February 17, 2022, 1:27pm UTC](https://forums.pimoroni.com/t/veml6075-micropython-driver/18906 "2022-02-17T13:27:01Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [February 19, 2022, 7:34pm UTC](https://forums.pimoroni.com/t/veml6075-micropython-driver/18906/4 "2022-02-19T19:34:15Z")

</div>

```auto
Traceback (most recent call last):
  File "<stdin>", line 12, in <module>
ValueError: BreakoutLTR559: Bad i2C object

```

Line 12 is `ltr = BreakoutLTR559(i2c)`

```auto
#import machine
from machine import I2C, Pin
sda=machine.Pin(4) # Explorer 20 Breakout 4
scl=machine.Pin(5) # Explorer 21 Breakout 5
i2c=machine.I2C(0,sda=sda, scl=scl, freq=400000)

import veml6075
import time
import machine

from breakout_ltr559 import BreakoutLTR559
ltr = BreakoutLTR559(i2c)
uv = veml6075.VEML6075(i2c)
connected = uv.initUV()
import picodisplay2 as display2
display_buffer = bytearray(320 * 240 * 2) # 2-bytes per pixel (RGB565)
display2.init(display_buffer)
display2.set_backlight(0.8)

while True:

    reading = ltr.get_reading()
    #print("Lux:", reading[BreakoutLTR559.LUX], "Prox:", reading[BreakoutLTR559.PROXIMITY])
    light = reading[BreakoutLTR559.LUX]
    
    display2.set_pen(0, 255, 0)
    display2.text("sun", 0, 70, 240, 3)
    
    #Convert light level in lux to descriptive value.
     
    if light < 50:
        display2.text("dark", 60, 70, 240, 3)
    elif 50 <= light < 100:
        display2.text("dim", 60, 70, 240, 3)
    elif 100 <= light < 500:
        display2.text("light", 60, 70, 240, 3)
    elif light >= 500:
        display2.text("bright", 60, 70, 240, 3)

    
    
    
    
    UVI, UVIA, UVIB = uv.readUV()
    display2.set_pen(0, 255, 0)
    #display2.text("uv", 0, 70, 240, 3)
    display2.text("UVIA {0:.1f}" .format(UVIA), 0, 180, 240, 3)
    display2.text("UVIB {0:.1f}" .format(UVIB), 0, 200, 240, 3)
    display2.text("UVI avg {0:.1f}" .format(UVI), 0, 220, 240, 3) 
    
    
    display2.update()
    display2.set_pen(0, 0, 0)
    display2.clear()
 
    time.sleep(1.0)

```

---

_[View the full topic](https://forums.pimoroni.com/t/veml6075-micropython-driver/18906)._
