diff --git a/buttonintr/.gitignore b/buttonintr/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/buttonintr/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/buttonintr/README.md b/buttonintr/README.md
new file mode 100644
index 0000000..8b3026d
--- /dev/null
+++ b/buttonintr/README.md
@@ -0,0 +1,53 @@
+Grove Button sample for Android Things using UPM
+-----------------------------------------------
+
+This example demonstrates a GPIO interrupts using UPM.
+
+Pre-Requisites:
+---------------
+Use of the Grove Kit (for Joule or Edison) makes this easy. See the following links for getting
+a starter kit.
+
+* https://www.seeedstudio.com/Grove-Maker-Kit-for-Intel-Joule-p-2796.html
+* https://www.seeedstudio.com/Grove-Starter-Kit-V3-p-1855.html
+
+
+You will need:
+
+1. Android Things compatible board.
+2. Grove header or Breakout board.
+3. A Grove push button.
+
+
+Build and install:
+------------------
+
+On Android Studio, select the "buttonintr" module in select box by the "Run" button
+and then click on the "Run" button.
+
+Changing the GPIO pin
+---------------------
+This example uses a GPIO (digital input) to read the state of a button. The GPIO could be connected
+via the shield to a Grove button... or it could be a button or wire on a breakout board directly
+connected between a GPIO line and Vcc.
+
+The GPIO line to be used is specified in the strings.xml file (src/res/values directory).
+
+````
+
+ ButtonIntr
+
+ IO0
+ GP20
+ J7_64
+
+````
+
+The code will automatically determine the board type being run on (modify BoardDefaults.java
+in the driver library to add another board) and select a string from this file for the GPIO line.
+The above example uses IO0 on the Edison Arduino shield and J7_64 on the Joule Tuchuck
+development board. These strings are programmed into the Peripheral Manager and read from their
+into the UPM library to determine the GPIO pin to be used.
+
+See the top level README.md for a table describing the available GPIO pins and where to find them
+on the board.
\ No newline at end of file
diff --git a/buttonintr/build.gradle b/buttonintr/build.gradle
new file mode 100644
index 0000000..f1f16ed
--- /dev/null
+++ b/buttonintr/build.gradle
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017 Intel Corporation.
+ *
+ * Licensed 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.
+ */
+
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 25
+ buildToolsVersion "25.0.2"
+
+ defaultConfig {
+ applicationId "com.example.upm.androidthings.driversamples"
+ minSdkVersion 24
+ targetSdkVersion 25
+ versionCode 1
+ versionName "1.0"
+
+ jackOptions {
+ enabled true
+ }
+
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile project(':driversupport')
+ compile 'io.mraa.at.upm:upm_grove:1.+'
+}
\ No newline at end of file
diff --git a/buttonintr/proguard-rules.pro b/buttonintr/proguard-rules.pro
new file mode 100644
index 0000000..3ea928f
--- /dev/null
+++ b/buttonintr/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /home/brillo/Android/Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/buttonintr/src/main/AndroidManifest.xml b/buttonintr/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..24abed1
--- /dev/null
+++ b/buttonintr/src/main/AndroidManifest.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/buttonintr/src/main/java/com/example/upm/androidthings/driversamples/ButtonIntrActivity.java b/buttonintr/src/main/java/com/example/upm/androidthings/driversamples/ButtonIntrActivity.java
new file mode 100644
index 0000000..be5ce14
--- /dev/null
+++ b/buttonintr/src/main/java/com/example/upm/androidthings/driversamples/ButtonIntrActivity.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2017 Intel Corporation.
+ *
+ * Licensed 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.
+ */
+
+package com.example.upm.androidthings.driversamples;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.TextView;
+
+import com.example.upm.androidthings.driversupport.BoardDefaults;
+
+import mraa.mraa;
+import mraa.Edge;
+
+public class ButtonIntrActivity extends Activity {
+ private static final String TAG = "ButtonIntrActivity";
+ public static int counter = 0;
+ upm_grove.GroveButton button;
+ TextView tv;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_button_intr);
+
+ tv = (TextView) findViewById(R.id.text_value);
+
+ int gpioIndex = -1;
+ int level = Edge.EDGE_RISING.swigValue();
+ BoardDefaults bd = new BoardDefaults(this.getApplicationContext());
+
+ switch (bd.getBoardVariant()) {
+ case BoardDefaults.DEVICE_EDISON_ARDUINO:
+ gpioIndex = mraa.getGpioLookup(getString(R.string.Button_Edison_Arduino));
+ break;
+ case BoardDefaults.DEVICE_EDISON_SPARKFUN:
+ gpioIndex = mraa.getGpioLookup(getString(R.string.Button_Edison_Sparkfun));
+ break;
+ case BoardDefaults.DEVICE_JOULE_TUCHUCK:
+ gpioIndex = mraa.getGpioLookup(getString(R.string.Button_Joule_Tuchuck));
+ break;
+ default:
+ throw new IllegalStateException("Unknown Board Variant: " + bd.getBoardVariant());
+ }
+
+ button = new upm_grove.GroveButton(gpioIndex);
+ ButtonISR callback = new ButtonISR();
+ button.installISR(level, callback);
+ }
+
+ private void updateUI(int bv) {
+ this.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ tv.setText(button.name() + " value is " + bv + " counter " + counter);
+ Log.i(TAG, "iteration: " + counter++ + ", " + button.name() + " value is " + bv);
+ }
+ });
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ Log.d(TAG, "in onDestroy() call");
+ button.delete();
+ }
+
+ class ButtonISR implements Runnable {
+
+ public void run() {
+ // Moves the current thread into the background
+ android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
+
+ try {
+ updateUI(button.value());
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ button.delete();
+ }
+ }
+ }
+}
diff --git a/buttonintr/src/main/res/layout/activity_button_intr.xml b/buttonintr/src/main/res/layout/activity_button_intr.xml
new file mode 100644
index 0000000..c3d2fa5
--- /dev/null
+++ b/buttonintr/src/main/res/layout/activity_button_intr.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
diff --git a/buttonintr/src/main/res/mipmap-hdpi/ic_launcher.png b/buttonintr/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/buttonintr/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/buttonintr/src/main/res/mipmap-hdpi/ic_launcher_round.png b/buttonintr/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9a078e3
Binary files /dev/null and b/buttonintr/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/buttonintr/src/main/res/mipmap-mdpi/ic_launcher.png b/buttonintr/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/buttonintr/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/buttonintr/src/main/res/mipmap-mdpi/ic_launcher_round.png b/buttonintr/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..efc028a
Binary files /dev/null and b/buttonintr/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/buttonintr/src/main/res/mipmap-xhdpi/ic_launcher.png b/buttonintr/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/buttonintr/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/buttonintr/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/buttonintr/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..3af2608
Binary files /dev/null and b/buttonintr/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/buttonintr/src/main/res/mipmap-xxhdpi/ic_launcher.png b/buttonintr/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/buttonintr/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/buttonintr/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/buttonintr/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9bec2e6
Binary files /dev/null and b/buttonintr/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/buttonintr/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/buttonintr/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/buttonintr/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/buttonintr/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/buttonintr/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..34947cd
Binary files /dev/null and b/buttonintr/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/buttonintr/src/main/res/values/strings.xml b/buttonintr/src/main/res/values/strings.xml
new file mode 100644
index 0000000..101988f
--- /dev/null
+++ b/buttonintr/src/main/res/values/strings.xml
@@ -0,0 +1,23 @@
+
+
+
+ ButtonIntr
+
+ IO0
+ GP20
+ J7_64
+
diff --git a/settings.gradle b/settings.gradle
index 8b67c1a..af68587 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -15,6 +15,7 @@
*/
include ':accel_on_lcd'
+include ':buttonintr'
include ':multisensor'
include ':ads1015'
include ':ssd1351'