I have a Raspberry Pi 3B+ and switches (jqc3f-05vdc-c). When I run simple program on python like this:

GPIO.setup(18, GPIO.OUT)
GPIO.output(18, 0)

my sweatch is off, on when i set GPIO.output(18, 1), but when I run program in Java:

private GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalMultipurpose gpio1 = gpio.provisionDigitalMultipurposePin(RaspiPin.GPIO_01,PinMode.DIGITAL_OUTPUT)
gpio1.low() //high state
gpio1.high() //low state

Default i have High state on all switches, but when i run method .high() my switch turn off.

Someone had the same problem?

  • what switch are you talking about? .... how is it connected to the RPi? .... how are you determining that the "switch" is on or off? – jsotola Aug 5 at 22:35
  • I am talking about Relay Module 5V x 8 Relay w/ Opto-isolation, it’s connected by: vcc to 5v, GND to GND, In1 to GPIO1 (PI4J schema). I am determining by dioda on the module and by electric meter. – Kuba K Aug 6 at 3:11
  • Please add the information, you have given in the comment, to your question. You can edit it. – Ingo Aug 6 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.