I have a Raspberry PI 3 model B.

I have 3 LEDs connected to the GPIO. They are on pin 7, 8, and 10.

I use the rpi_gpio Ruby gem to control the LEDs.

When I set 10 to high it lights up the LED connected to 10.

But when I set either of 7 or 8 low, it lights up the LED connected to 7 or 8 pins respectively.

That means the states should be opposite on the pins 10 and 8 for example.

Even though pin 12 is set to output, the behaviour reverses. In such case, my scripts fail: For example here are some simple scripts which work fine with LED on GPIO 7 and 8 but not when a LED is connected to pin 10 or 12!

Here is a program that should turn all the LEDs [on pin] 7, 8, 10 together:

#!/usr/bin/ruby -w
require 'rpi_gpio'

send(:set_warnings, false).send(:set_numbering, :board)

pins = [7, 8, 10].each { |x| setup(x, as: :output) }

# Set pins to high

sleep 3

# Turn all pins to low

sleep 3

# Clean up

But it rather turns on LED [on pin] 10 when others are off. When others (7, 8) are on, 10 is off. Why does the high and low state reverts for pin 7, 8 and 10, 12? Is this a bug?

  • Have you disabled the serial console? Have you disabled 1-wire? pinout.xyz details the default pins for interfaces like serial, i2c, spi and 1-wire.
    – Dougie
    Jul 27, 2019 at 19:43
  • Hi sorry for the terrible late reply. I chose to reinstall the OS because of some graphics related problems caused by raspi_config that I was unable to fix somehow. Anyways, I have not enabled the serial console, I haven't tweaked anything. Just a basic Arch Linux ARM on the Pi 3 model B and a Ruby gem called rpi_gpio (github.com/ClockVapor/rpi_gpio)... I have tried enabling and disabling 1-wire, generally with both 1wire enabled and disabled I see the same behaviour. I am not sure about the interface... Jul 28, 2019 at 19:25


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.