VL53L0x
VL53L0x
This is my first ever question in a forum like this. I need help. I am trying to use the lidar module from
https://bitbucket.org/thesheep/micropyt ... ew-default
I am using a pyboard. I am getting this error message:
Traceback (most recent call last):
File "main.py", line 14, in <module>
File "VL53L0X.py", line 116, in __init__
File "VL53L0X.py", line 167, in init
File "VL53L0X.py", line 152, in _flag
File "VL53L0X.py", line 148, in _register
File "VL53L0X.py", line 139, in _registers
OSError: [Errno 5] EIO
I have run a i2c scan and it returns [41]. Does that mean the address is 0x41? I thought it was supposed to be 0x29? I know basic programming. I don't know what this module is doing. Writing stuff to registers, I guess.
https://bitbucket.org/thesheep/micropyt ... ew-default
I am using a pyboard. I am getting this error message:
Traceback (most recent call last):
File "main.py", line 14, in <module>
File "VL53L0X.py", line 116, in __init__
File "VL53L0X.py", line 167, in init
File "VL53L0X.py", line 152, in _flag
File "VL53L0X.py", line 148, in _register
File "VL53L0X.py", line 139, in _registers
OSError: [Errno 5] EIO
I have run a i2c scan and it returns [41]. Does that mean the address is 0x41? I thought it was supposed to be 0x29? I know basic programming. I don't know what this module is doing. Writing stuff to registers, I guess.
Re: VL53L0x
i2c.scan returns decimal values. 41 decimal is 0x29.hex. So you can use as address either 41 or 0x29.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: VL53L0x
I have used this driver and it worked fine for me
Re: VL53L0x
[quote=Roberthh post_id=36211 time=1556724246 user_id=601]
i2c.scan returns decimal values. 41 decimal is 0x29.hex. So you can use as address either 41 or 0x29.
[/quote]
Thank you for that info.
i2c.scan returns decimal values. 41 decimal is 0x29.hex. So you can use as address either 41 or 0x29.
[/quote]
Thank you for that info.
Re: VL53L0x
[quote=OutoftheBOTS_ post_id=36220 time=1556745726 user_id=3423]
I have used this driver and it worked fine for me
[/quote]
On a pyboard 1.1? For something that is supposed to be a hobby, I find this very frustrating. I wish I understood programming more. I am fine with basic loops and stuff, but when they start doing 0xsomething, I don't know, and I don't like to not know. I have a master's degree in physics, so I hope I am capable of understanding this.
I have used this driver and it worked fine for me
[/quote]
On a pyboard 1.1? For something that is supposed to be a hobby, I find this very frustrating. I wish I understood programming more. I am fine with basic loops and stuff, but when they start doing 0xsomething, I don't know, and I don't like to not know. I have a master's degree in physics, so I hope I am capable of understanding this.
Re: VL53L0x
[quote=OutoftheBOTS_ post_id=36220 time=1556745726 user_id=3423]
I have used this driver and it worked fine for me
[/quote]
Could you just direct me to the code (or send me the code?) I need to understand this.
I have used this driver and it worked fine for me
[/quote]
Could you just direct me to the code (or send me the code?) I need to understand this.
Re: VL53L0x
Oh my god, it's working. Figured it out for myself, apparently. Thanks for almost helping me. Anyone know what course I should take (online since I live in Asia) or book I should read to understand how this driver works?
Re: VL53L0x
Glad it's working. This is a much more complicated driver compared to most simpler sensors.
There's a lot of things in between "basic loops and stuff" and "writing a driver". As a physicist you'll understand that in the same way there's a lot to learn between "F = ma" and (say) "Maxwell's equations".
To write a driver like this, the author probably started with a reference driver in C, e.g. likely the one from ST: https://my.st.com/content/my_st_com/en/ ... 1.0.2.html
And the reference manual: https://www.st.com/content/ccc/resource ... 279088.pdf
And the datasheet: https://www.st.com/resource/en/datasheet/vl53l0x.pdf
Ultimately this is an I2C device, so the pattern is pretty similar between them - send commands (like you say writing stuff to registers) and read data back. The trick is knowing what commands a given device expects.
The `0x` notation is hexadecimal.
At least you're doing this in MicroPython -- I can speak from experience that this would be even less fun on any other platform.
There's a lot of things in between "basic loops and stuff" and "writing a driver". As a physicist you'll understand that in the same way there's a lot to learn between "F = ma" and (say) "Maxwell's equations".
To write a driver like this, the author probably started with a reference driver in C, e.g. likely the one from ST: https://my.st.com/content/my_st_com/en/ ... 1.0.2.html
And the reference manual: https://www.st.com/content/ccc/resource ... 279088.pdf
And the datasheet: https://www.st.com/resource/en/datasheet/vl53l0x.pdf
Ultimately this is an I2C device, so the pattern is pretty similar between them - send commands (like you say writing stuff to registers) and read data back. The trick is knowing what commands a given device expects.
The `0x` notation is hexadecimal.
At least you're doing this in MicroPython -- I can speak from experience that this would be even less fun on any other platform.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: VL53L0x
@daemeon I strongly recommend learning Python on a PC using an online course or a book. Then notation like 0x42 or b'\x01' would make sense, along with many other language features which go beyond simple loops. With a good grasp of the language you'll be able to follow other people's code. This forum exists specifically to support MicroPython; a reasonable knowledge of Python is assumed.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: VL53L0x
Yes. I know what hexadecimal is. I just don't know about when and why and how to write to registers. Thank you. I have have studied python on the regular computer and I am coming from an arduino C++ background.pythoncoder wrote: ↑Thu May 02, 2019 8:13 am@daemeon I strongly recommend learning Python on a PC using an online course or a book. Then notation like 0x42 or b'\x01' would make sense, along with many other language features which go beyond simple loops. With a good grasp of the language you'll be able to follow other people's code. This forum exists specifically to support MicroPython; a reasonable knowledge of Python is assumed.