{"id":13480905,"url":"https://github.com/androidthings/sample-nativepio","last_synced_at":"2025-03-27T11:31:15.093Z","repository":{"id":97075424,"uuid":"81471035","full_name":"androidthings/sample-nativepio","owner":"androidthings","description":"Basic Peripheral I/O examples in C/C++ with Android Things","archived":false,"fork":false,"pushed_at":"2021-05-26T17:55:26.000Z","size":7538,"stargazers_count":48,"open_issues_count":5,"forks_count":28,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-30T14:42:49.316Z","etag":null,"topics":["android-ndk","android-things"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/androidthings.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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":"2017-02-09T16:35:39.000Z","updated_at":"2023-08-02T11:19:15.000Z","dependencies_parsed_at":"2024-01-14T09:08:50.577Z","dependency_job_id":"9a96ee71-1774-4619-b27a-ee40fb38398f","html_url":"https://github.com/androidthings/sample-nativepio","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/androidthings%2Fsample-nativepio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fsample-nativepio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fsample-nativepio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fsample-nativepio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/androidthings","download_url":"https://codeload.github.com/androidthings/sample-nativepio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245836081,"owners_count":20680316,"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":["android-ndk","android-things"],"created_at":"2024-07-31T17:00:46.421Z","updated_at":"2025-03-27T11:31:14.497Z","avatar_url":"https://github.com/androidthings.png","language":"C++","funding_links":[],"categories":["Useful links"],"sub_categories":["Sample apps and libraries"],"readme":"# Native Peripheral I/O\n\nThis Android Things app runs basic code that exercises the\n[Native PIO APIs][native-pio] from C++. Each sample is an Android module that\ncan be run independently.\n\n\u003e **Note:** The Android Things Console will be turned down for non-commercial\n\u003e use on January 5, 2022. For more details, see the\n\u003e [FAQ page](https://developer.android.com/things/faq).\n\n## Screenshots\n\n### Blink\n\n![Blink sample demo][demo1-gif]\n\n[(Watch the demo on YouTube)][demo1-yt]\n\n### Button\n\n![Button sample demo][demo2-gif]\n\n[(Watch the demo on YouTube)][demo2-yt]\n\n### Speaker\n\n![Speaker sample demo][demo3-gif]\n\n[(Watch the demo on YouTube)][demo3-yt]\n\n## Pre-requisites\n\n- Android Things compatible board\n- Android Studio 2.2+\n- Android NDK bundle\n\nFor the Blink sample:\n- 1 LED\n- 1 resistor\n- 2 jumper wires\n- 1 breadboard\n\nFor the Button sample:\n- 1 push button\n- 1 resistor\n- 2 jumper wires\n- 1 breadboard\n\nFor the Speaker sample:\n- 1 piezo buzzer\n- 2 jumper wires\n- 1 breadboard\n\n## Build and install\n\n[Download][releases] the latest Android Things native library release\nand extract it in the project root directory. You will need to change\nthe name of the extracted directory to `libandroidthings`.\n\nThe project root directory should contain the following native library\ndirectories:\n```\nlibandroidthings/\n  ${ABI}/\n    include/\n      pio/\n        *.h\n    lib/\n      libandroidthings.so\n```\n\nOn Android Studio, select the module in the select box by the \"Run\" button, and\nthen click on the \"Run\" button.\n\nIf you prefer to run on the command line, type\n\n```bash\n./gradlew \u003cmodule\u003e:installDebug\nadb shell am start com.example.androidthings.nativepio/.\u003cModuleActivity\u003e\n```\n\n## Sample Specifics\n\n### Blink\n\n![Schematics for Raspberry Pi 3](blink/rpi3_schematics.png)\n\n```bash\n    ./gradlew blink:installDebug\n    adb shell am start com.example.androidthings.nativepio/android.app.NativeActivity\n```\n\nBlinks an LED connected to a GPIO pin.\n\n### Button\n\n![Schematics for Raspberry Pi 3](button/rpi3_schematics.png)\n\n```bash\n    ./gradlew button:installDebug\n    adb shell am start com.example.androidthings.nativepio/android.app.NativeActivity\n```\n\nLogs to logcat when a button connected to a GPIO pin is pressed. Make sure you\nuse a pull-down or pull-up resistor to avoid fluctuation.\n\n### Speaker\n\n![Schematics for Raspberry Pi 3](speaker/rpi3_schematics.png)\n\n```bash\n    ./gradlew speaker:installDebug\n    adb shell am start com.example.androidthings.nativepio/android.app.NativeActivity\n```\n\nPlays an annoying alarm sound on the PWM speaker. Stop it by turning off the\nRaspberry Pi.\n\n## Enable auto-launch behavior\n\nThis sample app is currently configured to launch only when deployed from your\ndevelopment machine. To enable the main activity to launch automatically on boot,\nadd the following `intent-filter` to the app's manifest file:\n\n```xml\n\u003cactivity ...\u003e\n\n    \u003cintent-filter\u003e\n        \u003caction android:name=\"android.intent.action.MAIN\"/\u003e\n        \u003ccategory android:name=\"android.intent.category.HOME\"/\u003e\n        \u003ccategory android:name=\"android.intent.category.DEFAULT\"/\u003e\n    \u003c/intent-filter\u003e\n\n\u003c/activity\u003e\n```\n\n## License\n\nCopyright 2016 The Android Open Source Project, Inc.\n\nLicensed to the Apache Software Foundation (ASF) under one or more contributor\nlicense agreements.  See the NOTICE file distributed with this work for\nadditional information regarding copyright ownership.  The ASF licenses this\nfile to you under the Apache License, Version 2.0 (the \"License\"); you may not\nuse this file except in compliance with the License.  You may obtain a copy of\nthe License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\nWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the\nLicense for the specific language governing permissions and limitations under\nthe License.\n\n[native-pio]: https://developer.android.com/things/sdk/pio/native.html\n[releases]: https://github.com/androidthings/native-libandroidthings/releases\n[demo1-yt]: https://www.youtube.com/watch?v=47Rie4JpJ5M\u0026index=7\u0026list=PLWz5rJ2EKKc-GjpNkFe9q3DhE2voJscDT\n[demo1-gif]: demo1.gif\n[demo2-yt]: https://www.youtube.com/watch?v=ocHuWSHY0JA\u0026list=PLWz5rJ2EKKc-GjpNkFe9q3DhE2voJscDT\u0026index=8\n[demo2-gif]: demo2.gif\n[demo3-yt]: https://www.youtube.com/watch?v=xx6eCzG5Tq8\u0026list=PLWz5rJ2EKKc-GjpNkFe9q3DhE2voJscDT\u0026index=9\n[demo3-gif]: demo3.gif\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroidthings%2Fsample-nativepio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandroidthings%2Fsample-nativepio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroidthings%2Fsample-nativepio/lists"}