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

uk.pigpioj.test.PigpioThreadTest Maven / Gradle / Ivy

There is a newer version: 2.6.1
Show newest version
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