{"id":13612960,"url":"https://github.com/tuupola/micropython-lis2hh12","last_synced_at":"2025-04-12T01:21:40.396Z","repository":{"id":57441500,"uuid":"105072565","full_name":"tuupola/micropython-lis2hh12","owner":"tuupola","description":"MicroPython I2C driver for LIS2HH12 3-axis accelerometer","archived":false,"fork":false,"pushed_at":"2024-02-23T08:32:34.000Z","size":14,"stargazers_count":9,"open_issues_count":3,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-01T22:03:54.049Z","etag":null,"topics":["esp32","micropython"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tuupola.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-09-27T21:44:13.000Z","updated_at":"2024-08-01T20:44:28.653Z","dependencies_parsed_at":"2024-08-01T20:44:27.992Z","dependency_job_id":"f9324288-0d10-4acb-bc1b-b9019002a5af","html_url":"https://github.com/tuupola/micropython-lis2hh12","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"a9e6ebd8728e6932fa5b6ad7dc8fb57b5d191a43"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuupola%2Fmicropython-lis2hh12","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuupola%2Fmicropython-lis2hh12/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuupola%2Fmicropython-lis2hh12/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuupola%2Fmicropython-lis2hh12/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuupola","download_url":"https://codeload.github.com/tuupola/micropython-lis2hh12/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501860,"owners_count":21114684,"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":["esp32","micropython"],"created_at":"2024-08-01T20:00:37.290Z","updated_at":"2025-04-12T01:21:40.359Z","avatar_url":"https://github.com/tuupola.png","language":"Python","funding_links":[],"categories":["精选驱动库","Libraries"],"sub_categories":["传感器","Sensors"],"readme":"# MicroPython LIS2HH12 I2C driver\n\nMicroPython library for accessing the [STMicroelectronics LIS2HH12](http://www.st.com/en/mems-and-sensors/lis2hh12.html) 3-axis accelerometer over\nI2C. The LIS2HH12 is an ultra-low-power high-performance three-axis linear accelerometer belonging to the “pico” family. It has full scales of ±2g/±4g/±8g and is capable of measuring accelerations with output data rates from 10 Hz to 800 Hz.\n\n## Usage\n\nSimple test with never ending loop.\n\n```python\nimport utime\nfrom machine import I2C, Pin\nfrom lis2hh12 import LIS2HH12\n\ni2c = I2C(scl=Pin(26), sda=Pin(25))\nsensor = LIS2HH12(i2c)\n\nprint(\"LIS2HH12 id: \" + hex(sensor.whoami))\n\nwhile True:\n    print(sensor.acceleration)\n    utime.sleep_ms(1000)\n```\n\nBy default the library returns 3-tuple of X, Y, Z axis acceleration values in m/s^2 which is the SI standard. To get the acceleration values in g instead set the scale factor to `SF_G` in the constructor.\n\n```python\nfrom machine import I2C, Pin\nfrom lis2hh12 import LIS2HH12, SF_G\n\ni2c = I2C(scl=Pin(26), sda=Pin(25))\nsensor = LIS2HH12(i2c, sf=SF_G)\n```\n\nMore realistic example usage with timer. If you get `OSError: 26` or `i2c driver install error` after soft reboot do a hard reboot.\n\n```python\nimport micropython\nfrom machine import I2C, Pin, Timer\nfrom lis2hh12 import LIS2HH12\n\nmicropython.alloc_emergency_exception_buf(100)\n\ni2c = I2C(scl=Pin(26), sda=Pin(25))\nsensor = LIS2HH12(i2c)\n\ndef read_sensor(timer):\n    print(sensor.acceleration)\n\nprint(\"LIS2HH12 id: \" + hex(sensor.whoami))\n\ntimer_0 = Timer(0)\ntimer_0.init(period=1000, mode=Timer.PERIODIC, callback=read_sensor)\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuupola%2Fmicropython-lis2hh12","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuupola%2Fmicropython-lis2hh12","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuupola%2Fmicropython-lis2hh12/lists"}