I am looking to wire a break beam sensor to gather results and save them as eventually as JSON data. I am however totally new to hardware and believe there is an issue with the circuit.
I have the breadboard powered at 5V and the connected to the Pi in GPIO 12. As you can see from the image below I then have a 10k resistor running between the ground and the GPIO wire. I am fairly sure the python scripts I am using are correct but there could well be an issue there if the wiring is correct.
The current response I am getting is that the beam is always unbroken even when they are not. If there is anything else you wish for me to supply do let me know.
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(12, GPIO.IN) if True: if(GPIO.input(12) ==1): print(“Broken”) if(GPIO.input(12) == 0): print(“Un-broken”)