Samples
示例
Welcome to code samples for Android Things. Here you will find code snippets and tutorials to help you build embedded applications and integrate hardware peripherals. You can get started with the following samples:
欢迎来到 Android Things 代码示例。这里您可以找到帮助您构建嵌入式应用程序和集成硬件外部设备的代码片段和教程。您可以从一下实例开始:
- Simple PIO - Runs basic code that exercises the PIO APIs in Java. Each sample is an Android module that can be run independently.
- 简化 PIO - 运行基础代码练习 Java 语言下的 POI 接口。每个示例是都是一个可以独立运行的 Android 模块。
- Native PIO - Runs basic code that exercises the PIO APIs in C/C++. Each sample is an Android module that can be run independently.
- 本地化 PIO - 运行基础代码练习 C/C++ 语言下的 POI 接口。每个示例是都是一个可以独立运行的 Android 模块。
- Simple UI - Basic user interface that represents each GPIO on the board by an interactive switch widget on the display.
- 简化 UI - 利用显示器上的开关交互式窗口部件表示每块板子上 GPIO 的基础用户界面。
- Button - Using a button input driver from the peripheral driver library to listen for GPIO state changes and generate Android key events.
- 按钮 - 使用一个来自外围设备驱动程序库的输入驱动按钮监听 GPIO 状态变化和生成 Android 关键事件。
- UART Loopback - Emulates a loopback adapter for the selected UART port. Echoes all data back out the same port.
- 通用异步收发器回路 - 为选中通用异步收发器端口模拟一个回路。 将所有数据发射回同一个端口。
- Doorbell - Smart doorbell that captures a camera image, analyzes it, and sends it to a companion app using the Google Cloud Platform and Firebase.
- 门铃 - 智能门铃捕获摄像头图像并分析它,将分析结果发送到使用 Google Cloud 平台和 Firebase 的配套应用程序。
- Weather Station - Integration of multiple peripheral sensors to analyze and display current weather information. Data can optionally push to the Google Cloud Platform for further analysis.
- 气象站 - 集成多个外围传感设备分析并显示当前的天气信息。数据可以随意地推送到 Google Cloud 平台进行更进一步分析。
- TensorFlow - Demonstrates accessing the camera, performing object recognition and image classification using machine learning, and speaking out the results using text-to-speech (TTS).
- TensorFlow - 展示通过摄像头,使用机器学习进行对象识别和图像分类,并且使用文本到语音(TTS)说出结果。
- Bluetooth Audio - Enables a Bluetooth device to connect to a peer device and play audio on it (and vice-versa).
- 蓝牙音频 - 启动一个蓝牙设备连接到匹配的设备上并能够使其播放声音(反之亦然)。
- Bluetooth GATT Server - Exposes time information to client Bluetooth devices. The Android client receives a notification when the time is changed on the server.
- 蓝牙 GATT 服务器 - 与蓝牙客户端设备共享时间信息。当服务器上面的时间发生变化时 Android 客户端会接收到通知。
- USB Enumerator - Iterates over all the USB devices discovered by the host and prints their interfaces and endpoints.
- USB 计数器 - 遍历主机所有的 USB 设备并打印他们的接口和端点。
- 爱迪生蜡烛 - Uses an animation API to flicker a pair of LEDs to mimic the behavior of a candle. Includes hardware design files and a bill of materials to assist in building a production device.
- Edison Candle - 使用一个动画接口使一对 LEDs 闪烁来模拟蜡烛的行为。包括硬件设计文件和协助构建一个生产装置的物料清单。
- Cloud IoT Sensor Hub - Integration of a motion detector and weather-related peripheral sensors. Data is pushed to the Google Cloud Platform for low-latency messaging.
- 云物联网传感器集线器 - 运动监测器和天气相关的外设传感器的集合。数据以低延迟消息的形式被推送到 Google Cloud 平台。
- Google Assistant API - Demonstrates how to call the Google Assistant gRPC API from a device. Records the spoken request from a connected microphone and plays back the Assistant’s spoken response on a connected speaker.
- Google 助手接口 - 展示如何从设备调用 Google 助手 gRPC 接口。记录来自被连接的麦克风发起的语音请求并且在一个连接的扬声器上回应播放助理设备的语音响应。
- Drivers - Sample peripheral drivers for Android Things. Includes drivers for an OLED screen, GPS, accelerometer, and more.
- 驱动程序 - Android Things 外围设备驱动示例。包括一个 OLED 屏幕,GPS,加速器等等。
You can find additional code samples at the Android Things page on GitHub.
您可以在Github上的 Android Things 页面 找到更多的代码示例。