I need to figure out how to force the relay outputs on/off manually using Pi command prompts. How can i check for a high/low output on each GPIO pin?

  • 2
    Ah, multi-meter is my friend. – tlfong01 Sep 1 '20 at 14:38
  • 1
    need to use command prompts :/ – Pman5 Sep 1 '20 at 14:44
  • And I often use a always connected red status LED with a 1k series resister at the GPIO pin, as an alarm signal that the relay has switched on the nuclear reactor or coffee pot. – tlfong01 Sep 3 '20 at 2:44

Any GPIO library will let you test the levels of the GPIO.

One method using my pigpio library and the pigs utility.

# start the pigpio daemon

sudo pigpiod

# read GPIO 2 to 27

for ((i=2; i<28; i++)); do echo "GPIO $i is"; pigs r $i; done
  • Thanks this works! – Pman5 Sep 10 '20 at 13:18

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.