The MagPi - July 2018

(Steven Felgate) #1

(^24) July 2018 raspberrypi.org/magpi
Feature
rogramming Android Things is much like
making an Android app. It can make use of
Google services and is programmed in Java.
This means it’s a bit more advanced than using
Python in Raspbian – even something as simple as
lighting an LED takes a lot more time than using the
Python GPIO Zero library to do so.
Software is built into Android Studio and then
uploaded to your Raspberry Pi – this way you can
quickly prototype and test your code before updating it
and testing again. It also means you can have multiple
projects on the go that use the same Pi – you just need
to switch between them.
P
Learning how to use
the IoT-focused Android
USING
ANDROID
THINGS
Setting up an Android Studio project
Grab the Android
Studio software from
magpi.cc/DqPMKe.
Install it and then
open it, and go to
‘Start a new Android
Studio Project’. Call
it whatever you wish
and then select
Android Things as the
form factor, with the
latest SDK. You can then access your project through here, including
any previous code you’ve created or edited.
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
J8
3.3V
BCM2
BCM3
BCM4
Ground
BCM17
BCM27
BCM22
3.3V
BCM10
BCM9
BCM11
Ground
BCM5
BCM6
BCM13
BCM19
BCM26
Ground
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
5V
5V
Ground
BCM14
BCM15
BCM18
Ground
BCM23
BCM24
Ground
BCM25
BCM8
BCM7
Ground
BCM12
Ground
BCM16
BCM20
BCM 21
BCM2
BCM3
BCM7
BCM8
BCM9
BCM10
BCM11
BCM13
BCM14
BCM15
BCM18
BCM19
BCM20
BCM21
I2C1 (SDA)
I2C1 (SCL)
SPI0 (SS1)
SPI0 (SS0)
SPI0 (MISO)
SPI0 (MOSI)
SPI0 (SCLK)
PWM1
UART0 (TXD) or MINIUART (TXD)
UART0 (RXD) or MINIUART (RXD)
I2S1 (BCLK) or PWM0
I2S1 (LRCLK)
I2S1 (SDIN)
I2S1 (SDOUT)
GPIO SIGNAL
KNOW YOUR I/O

Free download pdf