AndroidThings之Start with Raspberry Pi 3

一、物料准备

  • Mac电脑
  • Raspberry Pi 3 Model B
  • 树莓派电源适配器(5V/2.5A 或 5V/2A)
  • Micro-USB线
  • 容量大于8G的SD卡
  • SD卡读卡器
  • 连接到Internet的网线
  • HDMI线
  • 支持HDMI的显示器

二、刷入Android Things

  1. 下载树莓派最新的Android Things镜像
  2. 将SD卡链接到Mac电脑,解压下载的镜像(>4G)
  3. 按照树莓派的官方说明将镜像写入SD卡
  4. 将刷入Android Things的SD卡插入树莓派
  5. 将树莓派接上电源,并通过HDMI线链接显示器

启动过程需要几分钟

  1. 启动


    AndroidThings之Start with Raspberry Pi 3_第1张图片
    start
  2. 载入中。。。


    AndroidThings之Start with Raspberry Pi 3_第2张图片
    loading
  3. 启动完成


    AndroidThings之Start with Raspberry Pi 3_第3张图片
    finish
  1. 插入网线,链接到网络,屏幕下部会显示IP地址
  2. 使用adb工具链接到该IP地址
$ adb connect 

三、链接wifi

使用adb工具链接到树莓派之后,可以使用adb工具链接wifi

  1. 启动wifi服务并设置SSID和密码
$ adb shell am startservice \
      -n com.google.wifisetup/.WifiSetupService \
      -a WifiSetupService.Connect \
      -e ssid  \
      -e passphrase 
  1. 验证wifi是否链接成功

可以通过两种方法:

  • 查看显示器下方,显示wifi连接状态


    AndroidThings之Start with Raspberry Pi 3_第4张图片
  • 使用adb工具查看log

$ adb logcat -d | grep Wifi
...
V WifiWatcher: Network state changed to CONNECTED
V WifiWatcher: SSID changed: ...
I WifiConfigurator: Successfully connected to ...


3. 测试是否可以连接到网络

$ adb shell ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=6.67 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=57 time=55.5 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=57 time=23.0 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=57 time=245 ms

你可能感兴趣的:(AndroidThings之Start with Raspberry Pi 3)