Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Things: Building for the IoT

Android Things: Building for the IoT

Joe Birch

June 22, 2017
Tweet

More Decks by Joe Birch

Other Decks in Technology

Transcript

  1. Use existing Android tools and APIs New IoT specific APIs

    Stay up-to-date with Android updates
  2. Switches GPIO General Purpose Input Output Output for Pin 1

    Output for Pin 2 Output for Pin 3 Output for Pin 5 Output for Pin 4 Output for Pin 6
  3. Using GPIO pins // Open the GPIO pin for usage

    val gpioPin = peripheralManagerService.openGpio(pin) // Direction Input or Output gpioPin.setDirection(DIRECTION_OUT_INITIALLY_LOW) // When the Pin is classified as Active gpioPin.setActiveType(ACTIVE_HIGH) gpioPin.setEdgeType(Gpio.EDGE_BOTH) gpioPin.registerGpioCallback(someCallback) gpioPin.setValue(true)
  4. Using GPIO pins // Open the GPIO pin for usage

    val gpioPin = peripheralManagerService.openGpio(pin) // Direction Input or Output gpioPin.setDirection(DIRECTION_OUT_INITIALLY_LOW) // When the Pin is classified as Active gpioPin.setActiveType(ACTIVE_HIGH) gpioPin.setEdgeType(Gpio.EDGE_BOTH) gpioPin.registerGpioCallback(someCallback) gpioPin.setValue(true)
  5. Using GPIO pins // Open the GPIO pin for usage

    val gpioPin = peripheralManagerService.openGpio(pin) // Direction Input or Output gpioPin.setDirection(DIRECTION_OUT_INITIALLY_LOW) // When the Pin is classified as Active gpioPin.setActiveType(ACTIVE_HIGH) gpioPin.setEdgeType(Gpio.EDGE_BOTH) gpioPin.registerGpioCallback(someCallback) gpioPin.setValue(true)
  6. Using GPIO pins // Open the GPIO pin for usage

    val gpioPin = peripheralManagerService.openGpio(pin) // Direction Input or Output gpioPin.setDirection(DIRECTION_OUT_INITIALLY_LOW) // When the Pin is classified as Active gpioPin.setActiveType(ACTIVE_HIGH) gpioPin.registerGpioCallback(someCallback) gpioPin.registerGpioCallback(someCallback) gpioPin.setValue(true)
  7. Switches IoT Launcher Starting your app at launch <application android:name=".BrailleBoxApplication"

    android:label="@string/app_name"> <uses-library android:name="com.google.android.things"/> <activity android:name=".ui.main.MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.IOT_LAUNCHER"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application>