Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Created April 30, 2017 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitherejoe/b8421d91fa1a35fa7095e872a48d0b98 to your computer and use it in GitHub Desktop.
Save hitherejoe/b8421d91fa1a35fa7095e872a48d0b98 to your computer and use it in GitHub Desktop.
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