2015-10-27 11:16:53 -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:16:53 -07:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2015-10-27 11:16:53 -07:00
|
|
|
*/
|
|
|
|
|
|
2016-09-07 10:18:06 -07:00
|
|
|
import upm_o2.O2;
|
2015-10-27 11:16:53 -07:00
|
|
|
|
2018-02-27 12:12:09 -08:00
|
|
|
public class O2_Example {
|
2015-10-27 11:16:53 -07:00
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
//! [Interesting]
|
|
|
|
|
// Initializing the Grove O2 sensor on the A) analog pin
|
2016-09-07 10:18:06 -07:00
|
|
|
O2 o2 = new O2(0);
|
2015-10-27 11:16:53 -07:00
|
|
|
|
|
|
|
|
while(true){
|
|
|
|
|
System.out.println("The output voltage is: "+o2.voltageValue());
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(100);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
2016-04-07 12:22:52 +03:00
|
|
|
System.out.println("The following exception has occurred: "+e.getMessage());
|
2015-10-27 11:16:53 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//! [Interesting]
|
|
|
|
|
}
|
2015-12-04 16:34:36 +02:00
|
|
|
}
|