Skip to content

Instantly share code, notes, and snippets.

@Manoj-nathwani
Last active May 24, 2016 20:59
Show Gist options
  • Save Manoj-nathwani/59b1c001c9991fd177f3abd57354a66a to your computer and use it in GitHub Desktop.
Save Manoj-nathwani/59b1c001c9991fd177f3abd57354a66a to your computer and use it in GitHub Desktop.
import time, datetime, json
import RPi.GPIO as GPIO
import picamera, dht11
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.cleanup()
instance = dht11.DHT11(pin=14)
result = instance.read()
if result.is_valid():
dht11_data = {
'Temperature': result.temperature,
'Humidity': result.humidity
}
with picamera.PiCamera() as camera:
camera.resolution = (2592, 1944)
camera.exif_tags['EXIF.UserComment'] = json.dumps(dht11_data)
camera.start_preview()
time.sleep(2)
camera.capture('image.jpg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment