Created
September 16, 2013 11:31
-
-
Save lillesand/6579519 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LedConfigTester { | |
public static void runEternally() throws InterruptedException { | |
GpioController gpioController = GpioFactory.getInstance(); | |
List<Pin> pins = asList(RaspiPin.GPIO_00, RaspiPin.GPIO_01, RaspiPin.GPIO_02, RaspiPin.GPIO_03, RaspiPin.GPIO_04); | |
List<GpioPinDigitalOutput> digitalPins = new ArrayList<GpioPinDigitalOutput>(); | |
for (Pin pin : pins) { | |
GpioPinDigitalOutput gpioPinDigitalOutput = gpioController.provisionDigitalOutputPin(pin, PinState.LOW); | |
digitalPins.add(gpioPinDigitalOutput); | |
} | |
while (true) { | |
System.out.println("Lights on!"); | |
for (GpioPinDigitalOutput digitalPin : digitalPins) { | |
digitalPin.setState(PinState.HIGH); | |
} | |
Thread.sleep(500); | |
System.out.println("Lights out…"); | |
for (GpioPinDigitalOutput digitalPin : digitalPins) { | |
digitalPin.setState(PinState.LOW); | |
} | |
Thread.sleep(500); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment