Skip to content

Instantly share code, notes, and snippets.

@hitherejoe hitherejoe/gpio.java Secret
Created Apr 30, 2017

Embed
What would you like to do?
public void openSolenoidGpioPins() {
solenoids.add(configureGpioPin(BoardDefaults.getFirstSolenoidGpioPin()));
solenoids.add(configureGpioPin(BoardDefaults.getSecondSolenoidGpioPin()));
solenoids.add(configureGpioPin(BoardDefaults.getThirdSolenoidGpioPin()));
solenoids.add(configureGpioPin(BoardDefaults.getFourthSolenoidGpioPin()));
solenoids.add(configureGpioPin(BoardDefaults.getFifthSolenoidGpioPin()));
solenoids.add(configureGpioPin(BoardDefaults.getSixthSolenoidGpioPin()));
}
private Gpio configureGpioPin(String pin) {
Gpio gpioPin = null;
try {
gpioPin = peripheralManagerService.openGpio(pin);
gpioPin.setDirection(DIRECTION_OUT_INITIALLY_LOW);
gpioPin.setActiveType(ACTIVE_HIGH);
} catch (IOException e) {
e.printStackTrace();
}
return gpioPin;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.