@IAMLIUBO Error with the TOF Unit with Alpha7
Connected to Serial Port!
>>>
>>> import gc
>>> gc.collect()
>>>
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== import os, sys, io
=== import M5
=== from M5 import *
=== from hardware import *
=== from unit.tof import ToF
=== from unit import *
=== title0 = None
=== label0 = None
=== i2c0 = None
=== tof_0 = None
=== def setup():
=== global title0, label0, i2c0, tof_0
=== i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
=== tof_0 = ToF(i2c0)
=== M5.begin()
=== title0 = Widgets.Title("Title", 3, 0xFFFFFF, 0x0000FF, Widgets.FONTS.DejaVu18)
=== label0 = Widgets.Label("Text", 23, 58, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
=== title0.setText('TOF Unit')
=== label0.setFont(Widgets.FONTS.DejaVu9)
=== def loop():
=== global title0, label0, i2c0, tof_0
=== M5.update()
=== label0.setText(str(((str('Distance: ') + str((tof_0.get_distance()))))))
=== if __name__ == '__main__':
=== try:
=== setup()
=== while True:
=== loop()
=== except (Exception, KeyboardInterrupt) as e:
=== try:
=== from utility import print_error_msg
=== print_error_msg(e)
=== except ImportError:
=== print("please update to latest firmware")
===
===
===
Traceback (most recent call last):
File "<stdin>", line 28, in <module>
File "<stdin>", line 23, in loop
File "driver/vl53l0x.py", line 521, in get_distance
AttributeError: 'VL53L0X' object has no attribute 'range'