2015-10-27 11:07:45 -07:00
|
|
|
/*
|
|
|
|
|
* Author: Abhishek Malik <abhishek.malik@intel.com>
|
|
|
|
|
* Copyright (c) 2015 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.
|
2015-10-27 11:07:45 -07:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2015-10-27 11:07:45 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import upm_hp20x.HP20X;
|
|
|
|
|
|
2018-02-27 12:12:09 -08:00
|
|
|
public class HP20x_Example {
|
2015-10-27 11:07:45 -07:00
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
//! [Interesting]
|
|
|
|
|
// Instantiate the sensor on the default I2C bus and sensor
|
|
|
|
|
HP20X hp20x = new HP20X();
|
|
|
|
|
|
|
|
|
|
// Initializing the sensor with the default values
|
|
|
|
|
hp20x.init();
|
|
|
|
|
|
|
|
|
|
while(true){
|
|
|
|
|
System.out.println("Temperature: "+hp20x.getTemperature()+"\tPressure: "+hp20x.getPressure()+"\tAltitude: "+hp20x.getAltitude());
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
2016-04-07 12:22:52 +03:00
|
|
|
System.out.println("The following exception occurred: "+e.getMessage());
|
2015-10-27 11:07:45 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//! [Interesting]
|
|
|
|
|
}
|
2015-12-04 16:34:36 +02:00
|
|
|
}
|