{"id":20430085,"url":"https://github.com/antirez/vl53l0x-nb","last_synced_at":"2025-05-08T17:32:37.647Z","repository":{"id":237444738,"uuid":"766868516","full_name":"antirez/vl53l0x-nb","owner":"antirez","description":"Fork of MicroPython driver for vl53l0x TOF sensor to add non-blocking mode.","archived":false,"fork":false,"pushed_at":"2024-03-04T09:28:11.000Z","size":6,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-03T00:03:52.516Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antirez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-04T09:27:44.000Z","updated_at":"2024-04-05T12:13:25.000Z","dependencies_parsed_at":"2024-05-01T23:52:48.599Z","dependency_job_id":null,"html_url":"https://github.com/antirez/vl53l0x-nb","commit_stats":null,"previous_names":["antirez/vl53l0x-nb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antirez%2Fvl53l0x-nb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antirez%2Fvl53l0x-nb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antirez%2Fvl53l0x-nb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antirez%2Fvl53l0x-nb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antirez","download_url":"https://codeload.github.com/antirez/vl53l0x-nb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253114733,"owners_count":21856555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T08:01:25.059Z","updated_at":"2025-05-08T17:32:37.640Z","avatar_url":"https://github.com/antirez.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Sensors"],"readme":"This code is a modified version of the Adafruit VL53L0X sensor distance driver.\nI found a modified version by Kevin Zhu that converted the code from CircuitPython to MicroPython. Then I added support for the much needed non-blocking reading mode.\n\nIn blocking mode, the reading is performed like this:\n\n    vl_i2c = I2C(1,sda=Pin(14),scl=Pin(15))\n    vl = VL53L0X(vl_i2c)\n    vl.range\n\nThe call to `vl.range` is blocking (in general defining what is a function as a property is bad, but if the latency is high, the property shell is even more misleading). Because the sensor phisically requires tens of milliseconds in order to finish the measure.\n\nThe driver does not support an interrupt mode with the callback AFAIK, so I\nmodified it in order to have two halves to perform the measurement: one that\nstarts the range process and the other that reads the result when available:\n\n    vl.start_range_request()\n    if vl.reading_available():\n        print(vl.get_range_value())\n\nYou can check if the request is already in progress with `vl.range_started`, which is set to True if a measurement process is already happening.\n\nSo a typical loop will look like:\n\n    while True:\n        if vl.range_started == False: vl.start_range_request()\n        if vl.reading_available():\n            ... do something with vl.get_range_value() ...\n\nIf a request was not initiated, `get_range_value()` just returns None.\n\nIn order to avoid confusion with the many forks of this code, I called the file vl53l0x_nb.py (\"nb\" = non blocking).\n\nThe driver is not clearly written and I don't want to make a rewrite because of the absurd ST(trademark) policy of not providing documentation for the chip, but if you have improvements, please send a pull request. Thanks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantirez%2Fvl53l0x-nb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantirez%2Fvl53l0x-nb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantirez%2Fvl53l0x-nb/lists"}