In Part 1
of his series on using Java ME 8 to control Internet of Things (IOT) devices--such as LEDs, relays, LCDs, sensors, motors, and switches--connected to a Raspberry Pi, Jose Cruz explained how to work with devices that use a simple general-purpose input/output (GPIO) interface. GPIO devices can be used as either a digital input or digital output, can be disabled or enabled, and can be used to drive interrupt lines. Part 1 explored how to connect and control a flame sensor, a movement sensor, and a motion sensor.
In Part 2 of his series
, Jose describes how to connect and control devices that use an inter-integrated circuit bus (I2C) interface, which is a multimaster, multislave, single-ended serial computer bus that enables you to read or write data beyond just changes in logic states.
Following Jose's instructions, you'll learn how connect a servo driver; a temperature and humidity sensor; a light and object proximity sensor; and a digital compass to the Raspberry Pi. Then, you'll see how to develop Java ME 8 classes that allow you to gather data from, write data to, and control these devices. The code for the classes is very similar, so once you understand it, you'll be able to create new classes that control additional I2C devices to create your very own IoT world.