uk.pigpioj.test.PigpioThreadTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pigpioj-java Show documentation
Show all versions of pigpioj-java Show documentation
Java wrapper around pigpio (http://abyz.me.uk/rpi/pigpio/)
package uk.pigpioj.test;
import uk.pigpioj.PigpioInterface;
import uk.pigpioj.PigpioJ;
public class PigpioThreadTest {
private static final int THREAD_COUNT = 10;
private static final int ITERATIONS = 10_000_000;
public static void main(String[] args) {
try (PigpioInterface pigpio_impl = PigpioJ.getImplementation()) {
int version = pigpio_impl.getVersion();
if (version < 0) {
System.out.println("Error initialising piogpio " + version);
return;
}
System.out.println("version: " + version);
int led_pin = 12;
for (int i=0; i onOffLoop(pigpio_impl, led_pin);
Thread t = new Thread(runnable);
t.setName("Test thread #" + i);
t.start();
}
}
}
private static void onOffLoop(PigpioInterface pigpioImpl, int pin) {
System.out.println("Thread " + Thread.currentThread().getName() + " started");
int rc;
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy