I am using raspberry pi B+ board. I have joined up an infrared sensor to GPIO 12. I want to use python to query this value, but I am getting "none" instead of a value.

This is the code I am using:

import RPi.GPIO as GPIO
value = GPIO.input(12)
print value 
  • How are you running the code? It works okay for me.
    – joan
    Jun 9 '15 at 10:40

Try to use GPIO.BCM instead of GPIO.BOARD. According to your code - it should be like that.

  • I don't think so ..this 12 is B plus physical interface. so it should be use GPIO.BOARD.
    – taylor
    Jun 10 '15 at 2:20

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.