org.bidib.jbidibc.pi.tools.BiDiBPiStandalone Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbidibc-pi-tools Show documentation
Show all versions of jbidibc-pi-tools Show documentation
jBiDiB jbidibc Pi tools POM. Use -Dpi4j.dev.transfer=true to transfer the artifact to the raspberry pi.
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);
}
}
}