@Component
public class MyComponent {
@GPIOService
GPIO gpio;
@Activate
public void activate() throws Exception {
gpio.start(10, GPIOParameters.builder().mode(OUTPUT).build());
}
@Deactivate
public void deactivate() throws Exception {
gpio.close(10);
}
public void toggleGpioPin() throws Exception {
gpio.setValue(10, HIGH);
Thread.sleep(1000);
gpio.setValue(10, LOW);
}
}