I found some code
in this post viewtopic.php?f=29&t=82373&hilit=under+ ... l&start=75
Code: Select all
#!/usr/bin/python import RPi.GPIO as GPIO , time redLED=35 GPIO.setmode(GPIO.BCM) GPIO.setup(redLED, GPIO.IN) powerlow=0 while True: if(GPIO.input(redLED)==0): print "POWER dipped below 4.63v" powerlow += 1 else: powerlow =0 if (powerlow > 3): print "Low power for " + str(powerlow) + " seconds" time.sleep(1)
but when I run it it immediately reports "POWER dipped below 4.63v" and continues to do so. I have had a voltmeter connected at the same time and it reads 5.14v, so the voltage is not actually low. What can cause this? How can I reliably detect low voltage?