Skip to content

Instantly share code, notes, and snippets.

@nkenna
Created August 5, 2018 12:29
Show Gist options
  • Save nkenna/a55a9aa7e82ad6000354e7bd3d5b3331 to your computer and use it in GitHub Desktop.
Save nkenna/a55a9aa7e82ad6000354e7bd3d5b3331 to your computer and use it in GitHub Desktop.
def ldr():
ldrValue = adc.read_adc(0, gain=GAIN)
return ldrValue
while True:
try:
print('LDR raw value: ' + str(ldr()))
sleep(2)
except KeyboardInterrupt:
GPIO.cleanup()
sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment