{"id":13481017,"url":"https://github.com/vishal-android-freak/ADXL362-Interfacing-Library","last_synced_at":"2025-03-27T11:31:51.104Z","repository":{"id":75872437,"uuid":"76864009","full_name":"vishal-android-freak/ADXL362-Interfacing-Library","owner":"vishal-android-freak","description":"ADXL362 Accelerometer Java and Android things Library for Raspberry Pi","archived":false,"fork":false,"pushed_at":"2017-01-11T05:01:58.000Z","size":19061,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-30T14:43:00.168Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/vishal-android-freak.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-12-19T13:20:36.000Z","updated_at":"2019-04-03T13:56:49.000Z","dependencies_parsed_at":"2023-02-25T01:15:54.236Z","dependency_job_id":null,"html_url":"https://github.com/vishal-android-freak/ADXL362-Interfacing-Library","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishal-android-freak%2FADXL362-Interfacing-Library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishal-android-freak%2FADXL362-Interfacing-Library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishal-android-freak%2FADXL362-Interfacing-Library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishal-android-freak%2FADXL362-Interfacing-Library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vishal-android-freak","download_url":"https://codeload.github.com/vishal-android-freak/ADXL362-Interfacing-Library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245836224,"owners_count":20680335,"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-07-31T17:00:47.712Z","updated_at":"2025-03-27T11:31:47.571Z","avatar_url":"https://github.com/vishal-android-freak.png","language":"Java","funding_links":[],"categories":["Useful links"],"sub_categories":["Drivers"],"readme":"# ADXL362 Java and AndroidThings Library\nADXL362B Accelerometer Java and Android Things Library\n\n# Java Documentation \n\nThis is a pure Java interfacing of Accelerometer ADXL362 with Raspberry Pi using pi4j on Raspbian.\nThis should work on any other OS for Raspberry Pi (or any other development platform, may be), which have Oracle JDK and pi4j support.\nX, Y, Z axis values are obtained as integers.\nTemperature values are obtained as integers.\n\n## Requirements\n \n 1. Raspberry Pi with raspbian\n 2. Orcale JDK (latest is recommended)\n 3. pi4j. Installation instructions [here](http://pi4j.com/install.html)\n\n## Sample usage\n\n```java\ntry {\n     Adxl362 adxl362 = new Adxl362(SpiChannel.CS0, 5000000, SpiMode.MODE_0);\n     adxl362.doSoftReset();\n     adxl362.beginMeasurement();\n     while(true) {\n                 System.out.println(\"X is: \" + adxl362.readXData() + \", Y is: \" + adxl362.readYData() + \", Z is: \" + adxl362.readZData() + \", TEMP is: \" + adxl362.readTempData());\n                Thread.sleep(1000);\n     }\n    } catch(IOException | InterruptedException e) {\n            e.printStackTrace();\n        }\n```\n\n\n\n# Android Things Documentation\n\n##How to use the library\n\n1. Clone the repository `git clone https://github.com/vishal-android-freak/ADXL362-Interfacing-Library.git`\n2. Clone the sample project template `https://github.com/androidthings/new-project-template.git` for android things or create your own project in Android studio following https://developer.android.com/things.\n3. In Android Studio, go to File \u003e New \u003e Import Module.\n4. Browse for the **ADXL362-Interfacing-Library** cloned folder.\n5. In the 'Module name' section type `:adxl`.\n6. Right click on the **app** folder and select 'Open Module Settings'.\n7. Go to the 'Dependencies' section and click on the '+' and select 'Module dependency'.\n8. Select ':adxl' and click Ok. Done!\n\n##Sample Usage\n\n```java\n\nimport vaf.vishal.Adxl362;\n\n.....\n\n// Access the environmental sensor directly:\n\nAdxl362 adxl;\n\ntry {\n    aadxl = new Adxl362(\"SPI0.0\", 5000000, SpiDevice.MODE0);\n} catch(IOException e) {\n  // couldn't configure the device...\n}\n\n//Read X, Y, Z axis and Temperature sensor values values in centimeters.\n\ntry {\n    float[] values = adxl.readXYZTempData();\n    Log.d(\"ADXL\", \"X is: \" + values[0] + \", Y is: \" + values[1] + \", Z is: \" + values[2] + \", TEMP is: \" + values[3]);\n} catch(IOException e) {\n  //error reading values.\n}\n\n//close the accelerometer after finished.\ntry {\n    adxl.close();\n} catch(IOException e) {\n  //error closing sensor.\n}\n\n```\n\nIf you need to read sensor values continuously, you can register the Hcsr04 with the system and listen for sensor values using the [Sensor APIs](https://developer.android.com/guide/topics/sensors/sensors_overview.html)\n\n```java\n\nSensorManager mSensorManager = getSystemService(Context.SENSOR_SERVICE);\nSensorEventListener mListener = ...;\nAdxl362AccelerometerDriver mSensorDriver;\n\nmSensorManager.registerDynamicSensorCallback(new SensorManager.DynamicSensorCallback() {\n    @Override\n    public void onDynamicSensorConnected(Sensor sensor) {\n          mSensorManager.registerListener(mListener, sensor,\n                  SensorManager.SENSOR_DELAY_NORMAL);\n    }\n});\n\ntry {\n    mSensorDriver = new Adxl362AccelerometerDriver(\"SPI0.0\", 5000000, SpiDevice.MODE0);\n    mSensorDriver.register();\n} catch (IOException e) {\n    // Error configuring sensor\n}\n\n// Unregister and close the driver when finished:\n\nmSensorManager.unregisterListener(mListener);\nmSensorDriver.unregister();\ntry {\n    mSensorDriver.close();\n} catch (IOException e) {\n    // error closing sensor\n}\n\n```\n\nTODO: Handle interrupt based interfacing.\n\n#License\n\nMIT License\n\nCopyright (c) 2017 Vishal Dubey\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishal-android-freak%2FADXL362-Interfacing-Library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvishal-android-freak%2FADXL362-Interfacing-Library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishal-android-freak%2FADXL362-Interfacing-Library/lists"}