Publishing temperature sensor data

Now we're going to implement simple code that can be used to read TMP102 temperature sensor data through the Raspberry Pi I2C bus 1. Listing 4-2 presents the Java class, which can be used to read the sensor data from TMP102 with the pi4j library. Add a new Java class file to your project by right-clicking on the IoTDashboard node, and from the context menu, click New|Java Class. Type Temperature Sensor in the Class Name text box and click the Finish button. An empty class file will be added to your project. Type all the lines listed under listing 4-2.

Listing 4-2:

    package com.packt.B05688.chapter4;import;import; ...

Get Raspberry Pi 3 Projects for Java Programmers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.