All Projects → androidthings → Sample Button

androidthings / Sample Button

Licence: apache-2.0
Basic input and output using a button and LED

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Sample Button

ThingsCommander
Things Commander System, based on Android Things developer preview 2
Stars: ✭ 13 (-87.85%)
Mutual labels:  android-things
Contrib Drivers
Open source peripheral drivers
Stars: ✭ 539 (+403.74%)
Mutual labels:  android-things
Androidthings Drivers
Android Things open source peripheral drivers
Stars: ✭ 30 (-71.96%)
Mutual labels:  android-things
sample-uartloopback
Echo received characters over a UART with Android Things
Stars: ✭ 71 (-33.64%)
Mutual labels:  android-things
Lantern
Transform any surface into mixed-reality using Raspberry Pi, a laser projector, and Android Things.
Stars: ✭ 403 (+276.64%)
Mutual labels:  android-things
Libaums
Open source library to access USB Mass Storage devices on Android without rooting your device
Stars: ✭ 769 (+618.69%)
Mutual labels:  android-things
androidthings-weatherstation
Codelab and solution for the Android Things Weatherstation
Stars: ✭ 16 (-85.05%)
Mutual labels:  android-things
Surviving With Android
Source code related to the posts in the blog
Stars: ✭ 1,275 (+1091.59%)
Mutual labels:  android-things
Sample Googleassistant
Google Assistant API sample for Android Things
Stars: ✭ 460 (+329.91%)
Mutual labels:  android-things
Androidthings Googleassistant
Integrate Google Assistant into Android Things
Stars: ✭ 28 (-73.83%)
Mutual labels:  android-things
android-things-samples
Samples and projects for platforms running Android Things
Stars: ✭ 23 (-78.5%)
Mutual labels:  android-things
Doorbell
Cloud-based photo doorbell with companion app
Stars: ✭ 298 (+178.5%)
Mutual labels:  android-things
Androidthings rainbowhatdemo
This Android Things project executes all the hardware that is on the Pimoroni Rainbow HAT for Android Things and Raspberry Pi 3
Stars: ✭ 17 (-84.11%)
Mutual labels:  android-things
native-libandroidthings
NDK library for exposing Peripheral I/O APIs in C/C++
Stars: ✭ 28 (-73.83%)
Mutual labels:  android-things
Android Sitemap
👓 Every link ever to Android Developer site.
Stars: ✭ 61 (-42.99%)
Mutual labels:  android-things
android-things-rc522
Android library to communicate with RFID Module RC522
Stars: ✭ 44 (-58.88%)
Mutual labels:  android-things
Sample Tensorflow Imageclassifier
Classify camera images locally using TensorFlow models
Stars: ✭ 623 (+482.24%)
Mutual labels:  android-things
Android Robocar
Build your own robocar, remote-controlled or autonomous, with Android Things.
Stars: ✭ 95 (-11.21%)
Mutual labels:  android-things
Sample Usbenum
Discover connected devices using the Android USB Host APIs
Stars: ✭ 81 (-24.3%)
Mutual labels:  android-things
Awesome Android Things
A curated list of awesome android things tutorials, libraries and much more at one place
Stars: ✭ 883 (+725.23%)
Mutual labels:  android-things

Button and LED

This Android Things sample demonstrates how to use a button input UserDriver to listen to GPIO pin changes, generate and listen for key events and change the state of an LED accordingly.

Screenshots

Button sample demo

(Watch the demo on YouTube)

Pre-requisites

  • Android Things compatible board
  • Android Studio 2.2+
  • Rainbow HAT for Android Things or the following individual components:
    • 1 LED
    • 1 push button
    • 2 resistors
    • jumper wires
    • 1 breadboard

Schematics

If you have the Raspberry Pi Rainbow HAT for Android Things, just plug it onto your Raspberry Pi 3.

Schematics for Raspberry Pi 3

Build and install

On Android Studio, click on the "Run" button.

If you prefer to run on the command line, type

./gradlew installDebug
adb shell am start com.example.androidthings.button/.ButtonActivity

If you have everything set up correctly, the LED will light up when you press the button and light off when you release it.

Enable auto-launch behavior

This sample app is currently configured to launch only when deployed from your development machine. To enable the main activity to launch automatically on boot, add the following intent-filter to the app's manifest file:

<activity ...>

    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.HOME"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>

</activity>

License

Copyright 2016 The Android Open Source Project, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].