-
-
Save Manoj-nathwani/59b1c001c9991fd177f3abd57354a66a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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