Peripheral I/O

外围设备输入输出

Android Things provides Peripheral I/O APIs to communicate with sensors and actuators using industry standard protocols and interfaces.

Android Things提供了一组外围设备输入输出的API用于和外围设备用于和传感器以及执行器进行通信的工业标准协议与接口。

General Purpose Input/Output (GPIO) - Use this API for simple sensors such as motion detectors, proximity detectors, and level switches that report their current state as a binary value—high or low.

通用输入/输出 (GPIO) - 这套API用于获取如运动探测器,近距离传感器和信号电平开关-状态在高或低电平间切换等简单传感器的输出与输入。

Pulse Width Modulation (PWM) - Use this API for servo motors, DC motors, and lights that require a proportional signal to provide fine-grained control over the output.

脉冲宽度调制 (PWM) - 这套API用于和舵机,直流电机和环境光传感器等需要获得等比例信号输出来进行细粒度控制的传感器进行通信。

Serial Communication - Use these APIs to transfer larger payloads of data between two or more smart devices connected on the same local bus. The following table outlines the basic attributes of each supported serial protocol:

串行通讯 - 这套API提供在接到同一本地总线上的两台或者多台智能设备之间进行较大数据量的传输。以下的表格概述了已支持的每类串行通讯协议的基本属性:

Protocol Transfer Type # of Wires # of Peripherals Transfer Speed
I2C Synchronous 2 Up to 127 Low
SPI Synchronous 4+ Unlimited High
UART Asynchronous 2 or 4 1 Medium
协议 传输类型 # 所需接线数量 # 可连接外围设备数量 传输速度
I2C 同步传输 2 多至 127
SPI 同步传输 4+ 无限量
UART 异步 2 或 4 1