org.pmw.tinylog.Logger Java Examples
The following examples show how to use
org.pmw.tinylog.Logger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WifiTracker.java From trackworktime with GNU General Public License v3.0 | 6 votes |
@Override public void onScanRequestFailed(@NonNull WifiScanner.Result failCode) { switch (failCode) { case FAIL_WIFI_DISABLED: Logger.warn("tracking by wifi, but wifi-radio is disabled. Retaining previous " + "tracking state"); break; case FAIL_SCAN_REQUEST_FAILED: Logger.info("wifi scan request failed, skipping wifi check - retaining previous " + "tracking state"); break; case FAIL_RESULTS_NOT_UPDATED: Logger.info("wifi scan results were not updated, skipping wifi check - retaining " + "previous tracking state"); break; case CANCEL_SPAMMING: Logger.warn("wifi scan request canceled, due to too much requests"); break; default: throw new UnsupportedOperationException("Unhandled wifi scan result code"); } }
Example #2
Source File: McpEeprom.java From diozero with MIT License | 6 votes |
public void writeBytes(int address, byte[] data) { if ((address + data.length) > type.getMemorySizeBytes()) { Logger.error("Attempt to write beyond memory size - no data written"); return; } int page = address / type.getPageSizeBytes(); int bytes_remaining = data.length; do { int remaining_page_size = type.getPageSizeBytes() - (address % type.getPageSizeBytes()); int bytes_to_write = remaining_page_size < bytes_remaining ? remaining_page_size : bytes_remaining; byte[] addr_bytes = getAddressByteArray(address); byte[] buffer = new byte[addr_bytes.length+bytes_to_write]; System.arraycopy(addr_bytes, 0, buffer, 0, addr_bytes.length); System.arraycopy(data, data.length - bytes_remaining, buffer, addr_bytes.length, bytes_to_write); device.write(buffer); bytes_remaining -= bytes_to_write; page++; address = page * type.getPageSizeBytes(); SleepUtil.sleepMillis(type.getWriteCycleTimeMillis()); } while (bytes_remaining > 0); }
Example #3
Source File: I2CDetect.java From diozero with MIT License | 6 votes |
public static void main(String[] args) { if (args.length < 1) { Logger.error("Usage: {} <i2c-controller> [first last]", I2CDetect.class.getName()); System.exit(1); } int controller = Integer.parseInt(args[0]); I2CDevice.ProbeMode mode = I2CDevice.ProbeMode.AUTO; int first = 0x03; int last = 0x77; if (args.length > 1) { first = Math.max(Integer.parseInt(args[1]), 0); } if (args.length > 2) { last = Math.min(Integer.parseInt(args[2]), 127); } scanI2CBus(controller, mode, first, last); }
Example #4
Source File: GpioPerfTest.java From diozero with MIT License | 6 votes |
public static void test(int pin, int iterations) { try (DigitalOutputDevice gpio = new DigitalOutputDevice(pin)) { for (int j=0; j<5; j++) { long start_nano = System.nanoTime(); for (int i=0; i<iterations; i++) { gpio.setValueUnsafe(true); gpio.setValueUnsafe(false); } long duration_ns = System.nanoTime() - start_nano; Logger.info("Duration for {} iterations: {}s", Integer.valueOf(iterations), String.format("%.4f", Float.valueOf(((float)duration_ns) / 1000 / 1000 / 1000))); } } catch (RuntimeIOException e) { Logger.error(e, "Error: {}", e); } }
Example #5
Source File: MqttTestClient.java From diozero with MIT License | 6 votes |
public MqttTestClient(String mqttUrl) throws MqttException { mqttClient = new MqttClient(mqttUrl, MqttClient.generateClientId(), new MemoryPersistence()); mqttClient.setCallback(this); MqttConnectOptions con_opts = new MqttConnectOptions(); con_opts.setAutomaticReconnect(true); con_opts.setCleanSession(true); mqttClient.connect(con_opts); Logger.debug("Connected to {}", mqttUrl); lock = new ReentrantLock(); conditions = new HashMap<>(); responses = new HashMap<>(); // Subscribe Logger.debug("Subscribing to {}...", MqttProviderConstants.RESPONSE_TOPIC); mqttClient.subscribe(MqttProviderConstants.RESPONSE_TOPIC); Logger.debug("Subscribed"); }
Example #6
Source File: GP2Y0A21YKApp.java From diozero with MIT License | 6 votes |
public static void main(String[] args) { if (args.length < 3) { Logger.error("Usage: {} <mcp-name> <chip-select> <adc-pin>", LDRTest.class.getName()); System.exit(2); } McpAdc.Type type = McpAdc.Type.valueOf(args[0]); if (type == null) { Logger.error("Invalid MCP ADC type '{}'. Usage: {} <mcp-name> <spi-chip-select> <adc_pin>", args[0], LDRTest.class.getName()); System.exit(2); } int chip_select = Integer.parseInt(args[1]); int adc_pin = Integer.parseInt(args[2]); float v_ref = 3.3f; test(type, chip_select, adc_pin, v_ref); }
Example #7
Source File: MFRC522Test.java From diozero with MIT License | 6 votes |
private static MFRC522.UID getID(MFRC522 mfrc522) { // If a new PICC placed to RFID reader continue if (! mfrc522.isNewCardPresent()) { return null; } Logger.debug("A card is present!"); // Since a PICC placed get Serial and continue MFRC522.UID uid = mfrc522.readCardSerial(); if (uid == null) { return null; } // There are Mifare PICCs which have 4 byte or 7 byte UID care if you use 7 byte PICC // I think we should assume every PICC as they have 4 byte UID // Until we support 7 byte PICCs Logger.info("Scanned PICC's UID: {}", Hex.encodeHexString(uid.getUidBytes())); mfrc522.haltA(); return uid; }
Example #8
Source File: PwmLedBarGraphTest.java From diozero with MIT License | 6 votes |
private static void test(int[] gpios) { int delay = 10; int duration = 4000; float[] cue_points = new float[] { 0, 0.5f, 1 }; List<KeyFrame[]> key_frames = KeyFrame.fromValues(new float[][] { {0}, {1f}, {0} }); try (MCP23008 expander = new MCP23008(); PwmLedBarGraph led_bar_graph = new PwmLedBarGraph(expander, gpios)) { Animation anim = new Animation(Arrays.asList(led_bar_graph), 50, Sine::easeIn, 1f); anim.setLoop(true); anim.enqueue(duration, cue_points, key_frames); Future<?> future = anim.play(); Logger.info("Sleeping for {} seconds", Integer.valueOf(delay)); SleepUtil.sleepSeconds(delay); future.cancel(true); } finally { // Required if there are non-daemon threads that will prevent the // built-in clean-up routines from running DeviceFactoryHelper.getNativeDeviceFactory().close(); } }
Example #9
Source File: CLIMain.java From dragonite-java with Apache License 2.0 | 6 votes |
private static String[] getArgs(final String[] cmdArgs) { final File argsFile = new File(ARGS_FILE_NAME); if (argsFile.canRead()) { try { final Scanner scanner = new Scanner(argsFile); final ArrayList<String> argsList = new ArrayList<>(); while (scanner.hasNext()) { argsList.add(scanner.next()); } scanner.close(); Logger.info("Arguments loaded from file \"{}\"", ARGS_FILE_NAME); return argsList.toArray(new String[0]); } catch (final FileNotFoundException e) { Logger.warn(e, "Unable to load file \"{}\", using commandline arguments", ARGS_FILE_NAME); return cmdArgs; } } else { Logger.info("Using commandline arguments"); return cmdArgs; } }
Example #10
Source File: PigpioJSpiDevice.java From diozero with MIT License | 6 votes |
public PigpioJSpiDevice(String key, DeviceFactoryInterface deviceFactory, PigpioInterface pigpioImpl, int controller, int chipSelect, int frequency, SpiClockMode spiClockMode, boolean lsbFirst) throws RuntimeIOException { super(key, deviceFactory); this.pigpioImpl = pigpioImpl; this.controller = controller; this.chipSelect = chipSelect; int flags = createSpiFlags(spiClockMode, controller, lsbFirst); int rc = pigpioImpl.spiOpen(chipSelect, frequency, flags); if (rc < 0) { handle = CLOSED; throw new RuntimeIOException(String.format("Error opening SPI device on controller %d, chip-select %d, response: %d", Integer.valueOf(controller), Integer.valueOf(chipSelect), Integer.valueOf(rc))); } handle = rc; Logger.debug("SPI device ({}-{}) opened, handle={}", Integer.valueOf(controller), Integer.valueOf(chipSelect), Integer.valueOf(handle)); }
Example #11
Source File: BitSetTest.java From diozero with MIT License | 6 votes |
private static int extractValue(ByteBuffer in, McpAdc.Type type) { /* * Rx x0RRRRRR RRRRxxxx for the 30xx (10-bit unsigned) * Rx x0RRRRRR RRRRRRxx for the 32xx (12-bit unsigned) * Rx x0SRRRRR RRRRRRRx for the 33xx (13-bit signed) */ if (type.isSigned()) { short s = in.getShort(); Logger.debug("Signed reading, s={}", Short.valueOf(s)); // Relies on the >> operator to preserve the sign bit return ((short) (s << 2)) >> (14+2-type.getResolution()); } // Note can't use >>> to propagate MSB 0s as it doesn't work with short, only integer return (in.getShort() & 0x3fff) >> (14 - type.getResolution()); }
Example #12
Source File: InputWaitTest.java From diozero with MIT License | 6 votes |
public static void test(int inputPin) { try (WaitableDigitalInputDevice input = new WaitableDigitalInputDevice(inputPin, GpioPullUpDown.PULL_UP, GpioEventTrigger.BOTH)) { while (true) { Logger.info("Waiting for 2000ms for button press"); boolean notified = input.waitForValue(false, 2000); Logger.info("Timed out? " + !notified); Logger.info("Waiting for 2000ms for button release"); notified = input.waitForValue(true, 2000); Logger.info("Timed out? " + !notified); } } catch (RuntimeIOException ioe) { Logger.error(ioe, "Error: {}", ioe); } catch (InterruptedException e) { Logger.error(e, "Error: {}", e); } }
Example #13
Source File: ReportsActivity.java From trackworktime with GNU General Public License v3.0 | 6 votes |
private boolean saveAndSendReport(String reportName, String filePrefix, String report) { File reportFile = ExternalStorage.writeFile("reports", filePrefix + "-" + reportName.replaceAll(" ", "-"), ".csv", report.getBytes(), this); if (reportFile == null) { String errorMessage = "could not write report to external storage"; Logger.error(errorMessage); Toast.makeText(getApplicationContext(), errorMessage, Toast.LENGTH_LONG).show(); return false; } // send the report Intent sendingIntent = new Intent(Intent.ACTION_SEND); sendingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Track Work Time Report"); sendingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "report time frame: " + reportName); Uri fileUri = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".util.GenericFileProvider", reportFile); sendingIntent.putExtra(Intent.EXTRA_STREAM, fileUri); sendingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); sendingIntent.setType("text/plain"); startActivity(Intent.createChooser(sendingIntent, "Send report...")); return true; }
Example #14
Source File: MySQLiteHelper.java From trackworktime with GNU General Public License v3.0 | 6 votes |
@Override public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) { Logger.warn("upgrading database from version {} to {}", oldVersion, newVersion); int currentVersion = oldVersion; if (currentVersion <= 1) { database.execSQL("drop table if exists " + TASK); database.execSQL("drop table if exists " + WEEK); database.execSQL("drop table if exists " + EVENT); dbSetup(database); currentVersion = 2; } if (currentVersion == 2) { dbUpgradeFrom2to3(database); currentVersion++; } if (currentVersion == 3) { dbUpgradeFrom3to4(database); currentVersion++; } if (currentVersion != newVersion) { throw new IllegalStateException("could not upgrade database"); } }
Example #15
Source File: ButtonTest.java From diozero with MIT License | 6 votes |
@Test public void test() { try (Button button = new Button(1, GpioPullUpDown.PULL_UP)) { button.whenPressed(() -> Logger.info("Pressed")); button.whenReleased(() -> Logger.info("Released")); button.addListener((event) -> Logger.info("valueChanged({})", event)); ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); ScheduledFuture<?> future = executor.scheduleAtFixedRate( () -> button.valueChanged(new DigitalInputEvent(button.getGpio(), System.currentTimeMillis(), System.nanoTime(), (i++ % 2) == 0)), 500, 500, TimeUnit.MILLISECONDS); SleepUtil.sleepSeconds(5); future.cancel(true); executor.shutdownNow(); } }
Example #16
Source File: BaseAsyncProtocolHandler.java From diozero with MIT License | 6 votes |
protected void processEvent(DigitalInputEvent event) { // Locate the input device for this GPIO PinInfo pin_info = deviceFactory.getBoardPinInfo().getByGpioNumber(event.getGpio()); if (pin_info == null) { Logger.error("PinInfo not found for GPIO " + event.getGpio()); return; } @SuppressWarnings("resource") RemoteDigitalInputDevice input_device = deviceFactory.getDevice(deviceFactory.createPinKey(pin_info), RemoteDigitalInputDevice.class); if (input_device == null) { Logger.error("Digital input device not found for GPIO " + event.getGpio()); return; } input_device.valueChanged(event); }
Example #17
Source File: Hexapod.java From diozero with MIT License | 6 votes |
private void testRange() { Logger.info("Testing servo ranges for all servos"); int delay = 10; float delta = 5; for (OutputDeviceCollection servos : Arrays.asList(l2, r2, l3, coxae, femura, tibiae, legs)) { for (float angle=trim.getMidAngle(); angle<trim.getMaxAngle(); angle+=delta) { servos.setValue(angle); SleepUtil.sleepMillis(delay); } for (float angle=trim.getMaxAngle(); angle>trim.getMinAngle(); angle-=delta) { servos.setValue(angle); SleepUtil.sleepMillis(delay); } for (float angle=trim.getMinAngle(); angle<trim.getMidAngle(); angle+=delta) { servos.setValue(angle); SleepUtil.sleepMillis(delay); } } }
Example #18
Source File: MPU9150DMPDriver.java From diozero with MIT License | 6 votes |
/** * Set DMP output rate. Only used when DMP is on. * @param rate Desired fifo rate (Hz). * @throws RuntimeIOException if an I/O error occurs */ public void dmp_set_fifo_rate(int rate) throws RuntimeIOException { Logger.debug("dmp_set_fifo_rate({})", rate); if (rate > DMP_SAMPLE_RATE) { Logger.warn( "Requested rate ({}) was greater than DMP_SAMPLE_RATE ({})", rate, DMP_SAMPLE_RATE); return; } int div = DMP_SAMPLE_RATE / rate - 1; Logger.debug("dmp_set_fifo_rate(), div={}", div); byte[] tmp = new byte[2]; tmp[0] = (byte) ((div >> 8) & 0xFF); tmp[1] = (byte) (div & 0xFF); mpu.mpu_write_mem(DMP612.D_0_22, 2, tmp); byte[] regs_end = { DINAFE, DINAF2, DINAAB, (byte) 0xc4, DINAAA, DINAF1, DINADF, DINADF, (byte) 0xBB, (byte) 0xAF, DINADF, DINADF }; mpu.mpu_write_mem(DMP612.CFG_6, 12, regs_end); fifo_rate = rate; }
Example #19
Source File: FirmataProtocolHandler.java From diozero with MIT License | 6 votes |
public FirmataProtocolHandler(RemoteDeviceFactory deviceFactory) { this.deviceFactory = deviceFactory; String hostname = PropertyUtil.getProperty(TCP_HOST_PROP, null); if (hostname != null) { int port = PropertyUtil.getIntProperty(TCP_PORT_PROP, DEFAULT_TCP_PORT); try { adapter = new SocketFirmataAdapter(this, hostname, port); } catch (IOException e) { throw new RuntimeIOException(e); } // } else { // String serial_port = PropertyUtil.getProperty(SERIAL_PORT_PROP, null); // if (serial_port != null) { // adapter = new SerialFirmataAdapter(serial_port) // } } if (adapter == null) { Logger.error("Please set either {} or {} property", TCP_HOST_PROP, SERIAL_PORT_PROP); throw new IllegalArgumentException("Either " + TCP_HOST_PROP + " or " + SERIAL_PORT_PROP + " must be set"); } }
Example #20
Source File: TimerManager.java From trackworktime with GNU General Public License v3.0 | 6 votes |
private boolean createEventForcibly(TrackingMethod method, boolean state) { if (state) { // method is clocked in now - should we generate a clock-in event? if (!isTracking()) { startTracking(0, null, null); Logger.debug("method {}: started tracking forcibly", method); return true; } else { Logger.debug("method {}: NOT started tracking forcibly (already clocked in)", method); return false; } } else { // method is clocked out now - should we generate a clock-out event? if (isTracking()) { stopTracking(0); Logger.debug("method {}: stopped tracking forcibly", method); return true; } else { Logger.debug("method {}: NOT stopped tracking forcibly (already clocked out)", method); return false; } } }
Example #21
Source File: MultiButtonTest.java From diozero with MIT License | 6 votes |
public static void test(int inputPin1, int inputPin2, int inputPin3) { try (Button button1 = new Button(inputPin1, GpioPullUpDown.PULL_UP); Button button2 = new Button(inputPin2, GpioPullUpDown.PULL_UP); Button button3 = new Button(inputPin3, GpioPullUpDown.PULL_UP)) { button1.whenPressed(() -> Logger.info("1 Pressed")); button1.whenReleased(() -> Logger.info("1 Released")); button1.addListener(event -> Logger.info("1 valueChanged({})", event)); button2.whenPressed(() -> Logger.info("2 Pressed")); button2.whenReleased(() -> Logger.info("2 Released")); button2.addListener(event -> Logger.info("2 valueChanged({})", event)); button3.whenPressed(() -> Logger.info("3 Pressed")); button3.whenReleased(() -> Logger.info("3 Released")); button3.addListener(event -> Logger.info("3 valueChanged({})", event)); Logger.debug("Waiting for 10s - *** Press the button connected to an input pin ***"); SleepUtil.sleepSeconds(10); } catch (RuntimeIOException ioe) { Logger.error(ioe, "Error: {}", ioe); } }
Example #22
Source File: ProtobufMqttProtocolHandler.java From diozero with MIT License | 6 votes |
public ProtobufMqttProtocolHandler(NativeDeviceFactoryInterface deviceFactory) { super(deviceFactory); String mqtt_url = PropertyUtil.getProperty(MQTT_URL_PROP, null); if (mqtt_url == null) { throw new RuntimeIOException("Property '" + MQTT_URL_PROP + "' must be set"); } try { mqttClient = new MqttClient(mqtt_url, MqttClient.generateClientId(), new MemoryPersistence()); mqttClient.setCallback(this); MqttConnectOptions con_opts = new MqttConnectOptions(); con_opts.setAutomaticReconnect(true); con_opts.setCleanSession(true); mqttClient.connect(con_opts); Logger.debug("Connected to {}", mqtt_url); // Subscribe Logger.debug("Subscribing to response and notification topics..."); mqttClient.subscribe(MqttProviderConstants.RESPONSE_TOPIC); mqttClient.subscribe(MqttProviderConstants.GPIO_NOTIFICATION_TOPIC); Logger.debug("Subscribed"); } catch (MqttException e) { throw new RuntimeIOException(e); } }
Example #23
Source File: MotionTest.java From diozero with MIT License | 6 votes |
@SuppressWarnings("resource") private MotionTest(int... pins) { sensors = new ArrayList<>(); for (int pin : pins) { //DigitalInputDevice sensor = new MotionSensor(pin); DigitalInputDevice sensor; if (pin == 26) { // Fudge for this strange type of PIR: // http://skpang.co.uk/catalog/pir-motion-sensor-p-796.html // Red (5V) / White (Ground) / Black (open collector Alarm) // The alarm pin is an open collector meaning you will need a pull up resistor on the alarm pin // Signal motion if there are 5 or more alarms in a 200ms period, check every 50ms sensor = new MotionSensor(pin, GpioPullUpDown.PULL_UP, 5, 200, 50); } else { sensor = new DigitalInputDevice(pin, GpioPullUpDown.PULL_DOWN, GpioEventTrigger.BOTH); } Logger.info("Created sensor on pin " + pin + " pud=" + sensor.getPullUpDown() + ", trigger=" + sensor.getTrigger()); sensor.whenActivated(() ->System.out.println("Pin " + pin + " activated")); sensor.whenDeactivated(() ->System.out.println("Pin " + pin + " deactivated")); sensors.add(sensor); } }
Example #24
Source File: JdkDeviceIoDigitalInputDevice.java From diozero with MIT License | 5 votes |
@Override protected void closeDevice() throws RuntimeIOException { Logger.debug("closeDevice()"); removeListener(); if (pin.isOpen()) { try { pin.close(); } catch (IOException e) { throw new RuntimeIOException(e); } } }
Example #25
Source File: CassandraDriverTest.java From cassandra-jdbc-driver with Apache License 2.0 | 5 votes |
@Test(groups = {"unit", "server"}) public void testConnect() { CassandraDriver driver = new CassandraDriver(); try { CassandraConfiguration config = CassandraConfiguration.DEFAULT; Properties props = new Properties(); props.setProperty(KEY_USERNAME, config.getUserName()); props.setProperty(KEY_PASSWORD, config.getPassword()); Connection conn = driver.connect(config.getConnectionUrl(), props); assertTrue(conn instanceof BaseCassandraConnection); assertTrue(conn.getClass().getName() .endsWith("datastax.CassandraConnection")); conn.setSchema("system"); ResultSet rs = conn.createStatement().executeQuery( "select * from peers limit 5"); while (rs.next()) { Logger.debug("{}\n=====", rs.getRow()); for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { Object obj = rs.getObject(i); Logger.debug("[{}]=[{}]", rs.getMetaData().getColumnName(i), obj == null ? "null" : obj.getClass() + "@" + obj.hashCode()); } } rs.close(); conn.close(); } catch (Exception e) { e.printStackTrace(); fail("Exception happened during test: " + e.getMessage()); } }
Example #26
Source File: DiozeroProtosConverter.java From diozero with MIT License | 5 votes |
public static DiozeroProtos.Gpio.Trigger convert(GpioEventTrigger trigger) { switch (trigger) { case NONE: return DiozeroProtos.Gpio.Trigger.TRIGGER_NONE; case RISING: return DiozeroProtos.Gpio.Trigger.TRIGGER_RISING; case FALLING: return DiozeroProtos.Gpio.Trigger.TRIGGER_FALLING; case BOTH: return DiozeroProtos.Gpio.Trigger.TRIGGER_BOTH; default: Logger.error("Invalid GpioEventTrigger value: {}", trigger); return DiozeroProtos.Gpio.Trigger.TRIGGER_BOTH; } }
Example #27
Source File: PwmLedBarGraphTest.java From diozero with MIT License | 5 votes |
public static void main(String[] args) { if (args.length < 1) { Logger.error("Usage: {} <LED GPIOs>", LedBarGraph.class.getName()); System.exit(1); } String[] gpio_string = args[0].split(","); int[] gpios = new int[gpio_string.length]; for (int i=0; i<gpio_string.length; i++) { gpios[i] = Integer.parseInt(gpio_string[i]); } test(gpios); }
Example #28
Source File: CassandraResultSetMetaData.java From cassandra-jdbc-driver with Apache License 2.0 | 5 votes |
public CassandraColumnDefinition getColumnDefinition(int column) throws SQLException { if (column > 0 && column <= columnDefinitions.size()) { return columnDefinitions.get(column - 1); } Logger.trace("Columns for your reference: " + columnNameIndices); throw new SQLException("Column " + column + " does not exists!"); }
Example #29
Source File: Hexapod.java From diozero with MIT License | 5 votes |
private void setTo(Positions position, int forwardMidRear) { Logger.info("Setting positions to " + forwardMidRear); frontCoxae.setValue(position.front.coxae[forwardMidRear]); frontFemura.setValue(position.front.femura[forwardMidRear]); frontTibiae.setValue(position.front.tibiae[forwardMidRear]); midCoxae.setValue(position.mid.coxae[forwardMidRear]); midFemura.setValue(position.mid.femura[forwardMidRear]); midTibiae.setValue(position.mid.tibiae[forwardMidRear]); rearCoxae.setValue(position.rear.coxae[forwardMidRear]); rearFemura.setValue(position.rear.femura[forwardMidRear]); rearTibiae.setValue(position.rear.tibiae[forwardMidRear]); }
Example #30
Source File: BME280Test.java From diozero with MIT License | 5 votes |
public static void main(String[] args) { try (BME280 bme280 = new BME280()) { for (int i=0; i<10; i++) { float[] tph = bme280.getValues(); Logger.info("Temperature: {0.##} C. Pressure: {0.##} hPa. Relative Humidity: {0.##}% RH", Double.valueOf(tph[0]), Double.valueOf(tph[1]), Double.valueOf(tph[2])); SleepUtil.sleepSeconds(1); } } finally { // Required if there are non-daemon threads that will prevent the // built-in clean-up routines from running DeviceFactoryHelper.getNativeDeviceFactory().close(); } }