2016-11-17 16:20:29 -08:00
|
|
|
/*
|
2016-11-29 08:51:45 -08:00
|
|
|
* Author: Noel Eck <noel.eck@intel.com>
|
2016-11-17 16:20:29 -08:00
|
|
|
* Copyright (c) 2016 Intel Corporation.
|
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2016-11-17 16:20:29 -08:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2016-11-17 16:20:29 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import upm_ims.IMS;
|
|
|
|
|
|
|
|
|
|
public class IMS_Example
|
|
|
|
|
{
|
|
|
|
|
public static void main(String[] args) throws InterruptedException
|
|
|
|
|
{
|
|
|
|
|
// ! [Interesting]
|
|
|
|
|
|
|
|
|
|
// Instantiate a IMS instance using bus 0 and default i2c address
|
2016-11-29 09:56:57 -08:00
|
|
|
IMS sensor = new IMS((short)0);
|
2016-11-17 16:20:29 -08:00
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
System.out.println("Version: "
|
|
|
|
|
+ sensor.get_version()
|
|
|
|
|
+ " light: "
|
|
|
|
|
+ sensor.get_light()
|
|
|
|
|
+ " moisture: "
|
|
|
|
|
+ sensor.get_moisture()
|
|
|
|
|
+ " temp: "
|
|
|
|
|
+ sensor.get_temperature()
|
|
|
|
|
+ " C");
|
|
|
|
|
|
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ! [Interesting]
|
|
|
|
|
}
|
|
|
|
|
}
|