All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bidib.jbidibc.pi.tools.BiDiBPiStandalone Maven / Gradle / Ivy

Go to download

jBiDiB jbidibc Pi tools POM. Use -Dpi4j.dev.transfer=true to transfer the artifact to the raspberry pi.

There is a newer version: 2.0.28
Show newest version
package org.bidib.jbidibc.pi.tools;

import org.bidib.jbidibc.pi.BidibPiConnector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BiDiBPiStandalone {

    private static final Logger LOGGER = LoggerFactory.getLogger(BiDiBPiStandalone.class);

    public static void main(String[] args) {
        LOGGER.info("Standalone is started.");

        try (BidibPiConnector connector = new BidibPiConnector()) {

            connector.connect();

            LOGGER.info("Press Ctrl+C to terminate the loop.");
            // keep program running until user aborts (CTRL-C)
            while (true) {

                try {
                    Thread.sleep(500);
                }
                catch (InterruptedException e) {
                    LOGGER.warn("Wait was interrupted. Leave the loop!");

                    break;
                }
            }

            connector.disconnect();

            LOGGER.info("Standalone has finished.");
        }
        catch (Exception ex) {
            LOGGER.warn("Start the standalone pi connector failed.", ex);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy