I'm trying to turn on and off relay using raspberry pi 3. But after successfully turn on, it will stay on even after I set GPIO pin to low.
I use pi4j example and python example, both of them give me same result.
this is the code
final GpioController gpio = GpioFactory.getInstance();
final GpioPinDigitalOutput pin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_29, "MyLED", PinState.HIGH);
pin.setShutdownOptions(true, PinState.LOW);
System.out.println("--> GPIO state should be: ON");
Thread.sleep(5000);
pin.low();
System.out.println("--> GPIO state should be: OFF");
Thread.sleep(5000);
pin.toggle();
System.out.println("--> GPIO state should be: ON");
Thread.sleep(5000);
pin.toggle();
System.out.println("--> GPIO state should be: OFF");
Thread.sleep(5000);
pin.pulse(1000, true); // set second argument to 'true' use a blocking call
gpio.shutdown();
Please help, thank you.