{"id":13480882,"url":"https://github.com/androidthings/sample-simplepio","last_synced_at":"2025-03-27T11:31:06.156Z","repository":{"id":97075441,"uuid":"76376211","full_name":"androidthings/sample-simplepio","owner":"androidthings","description":"Basic Peripheral I/O examples with Android Things","archived":false,"fork":false,"pushed_at":"2021-05-26T17:55:30.000Z","size":10047,"stargazers_count":189,"open_issues_count":2,"forks_count":79,"subscribers_count":30,"default_branch":"master","last_synced_at":"2024-10-30T14:42:42.047Z","etag":null,"topics":["android-things"],"latest_commit_sha":null,"homepage":"","language":"Java","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":"2016-12-13T16:14:09.000Z","updated_at":"2024-10-02T20:08:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"64ccbba2-f683-4760-9b94-e268a8956fe8","html_url":"https://github.com/androidthings/sample-simplepio","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-simplepio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fsample-simplepio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fsample-simplepio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fsample-simplepio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/androidthings","download_url":"https://codeload.github.com/androidthings/sample-simplepio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245836044,"owners_count":20680310,"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-things"],"created_at":"2024-07-31T17:00:46.196Z","updated_at":"2025-03-27T11:31:05.424Z","avatar_url":"https://github.com/androidthings.png","language":"Java","funding_links":[],"categories":["Useful links"],"sub_categories":["Sample apps and libraries"],"readme":"# Simple Peripheral I/O\n\nThis Android Things app runs basic code that exercises the Peripheral I/O APIs.\nEach sample is an Android module that can 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## Introduction\n\nThis sample provides an introduction to using the [Peripheral I/O][pio] APIs\non Android Things. You will learn the basic concepts of opening connections to\nvarious inputs and outputs for connecting with external peripherals in your app.\n\n**IMPORTANT**: Please, note that these samples are not necessarily the easiest way to accomplish\na task. In particular, they handle all low level I/O protocols directly, on\npurpose to showcase how to use the Peripheral APIs. In real world applications,\nyou should use or develop a suitable driver that encapsulates the manipulation\nof low level APIs.\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### PWM\n\n![PWM 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\nFor the Blink sample:\n- [Rainbow Hat for Android Things](https://shop.pimoroni.com/products/rainbow-hat-for-android-things) or the following individual components:\n    - 1 LED\n    - 1 resistor\n    - 2 jumper wires\n    - 1 breadboard\n\nFor the Button sample:\n- [Rainbow Hat for Android Things](https://shop.pimoroni.com/products/rainbow-hat-for-android-things) or the following individual components:\n    - 1 push button\n    - 1 resistor\n    - 2 jumper wires\n    - 1 breadboard\n\nFor the PWM sample:\n- 1 servo\n- 3 jumper wires\n- external power source (recommended, depending on the servo)\n\n## Build and install\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.simplepio/.\u003cModuleActivity\u003e\n```\n\n## Sample Specifics\n\n### Blink\n\nIf you have the Raspberry Pi [Rainbow Hat for Android Things](https://shop.pimoroni.com/products/rainbow-hat-for-android-things), just plug it onto your Raspberry Pi 3.\n\n![Schematics for Raspberry Pi 3](rpi3_schematics_blink.png)\n\n```bash\n    ./gradlew blink:installDebug\n    adb shell am start com.example.androidthings.simplepio/.BlinkActivity\n```\n\nBlinks an LED connected to a GPIO pin.\n\n### Button\n\nIf you have the Raspberry Pi [Rainbow Hat for Android Things](https://shop.pimoroni.com/products/rainbow-hat-for-android-things), just plug it onto your Raspberry Pi 3.\n\n![Schematics for Raspberry Pi 3](rpi3_schematics_button.png)\n\n```bash\n    ./gradlew button:installDebug\n    adb shell am start com.example.androidthings.simplepio/.ButtonActivity\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### PWM\n\n![Schematics for Raspberry Pi 3](rpi3_schematics_pwm.png)\n\n```bash\n    ./gradlew pwm:installDebug\n    adb shell am start com.example.androidthings.simplepio/.PwmActivity\n```\n\nMoves a servo from one side to the other on regular steps at a predefined rate.\n\nServos in general have three wires: Vcc, ground and signal. Connect Vcc to the\nboard's Vcc or, ideally, to an external power. Ground should go to the board's\nground, and signal goes to the PWM pin specified in the BoardDefaults class. The\nmost common colors for each wire are red for Vin, gray for ground and orange for\nsignal, but confirm with your servo's datasheet to be sure.\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[pio]: https://developer.android.com/things/sdk/pio/index.html\n[demo1-yt]: https://www.youtube.com/watch?v=QjX-yfbKAiM\u0026index=4\u0026list=PLWz5rJ2EKKc-GjpNkFe9q3DhE2voJscDT\n[demo1-gif]: demo1.gif\n[demo2-yt]: https://www.youtube.com/watch?v=pgpTpzl7QWY\u0026list=PLWz5rJ2EKKc-GjpNkFe9q3DhE2voJscDT\u0026index=5\n[demo2-gif]: demo2.gif\n[demo3-yt]: https://www.youtube.com/watch?v=H148X62lmrQ\u0026list=PLWz5rJ2EKKc-GjpNkFe9q3DhE2voJscDT\u0026index=6\n[demo3-gif]: demo3.gif\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroidthings%2Fsample-simplepio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandroidthings%2Fsample-simplepio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroidthings%2Fsample-simplepio/lists"}