Am trying to add a LDR switch to my raspberry ans update one switch without success.
Connected my sensor to raspberry 2B following this guide http://www.uugear.com/portfolio/using-l ... pberry-pi/
When i run the python code "lm393.py" bellow:
Code: Select all
#!/usr/bin/python
import sys
sys.path.append ('/storage/.kodi/addons/debug.tools.i2c-tools/lib')
sys.path.append ('/storage/lib')
import smbus
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(4,GPIO.IN)
for i in range(0,5):
print GPIO.input(4)
Code: Select all
pi@Rpi-2B:~ $ ./lm393.py
0
0
0
0
0
pi@Rpi-2B:~ $
- added a switch as described in https://www.domoticz.com/wiki/GPIO
- exported the GPIO 4
Code: Select all
pi@Rpi-2B:~ $ gpio exports
GPIO Pins exported:
4: in 0 both
pi@Rpi-2B:~ $
What am doing wrong???????
.