0% found this document useful (0 votes)
6 views2 pages

IOT Assignment Code

The document contains three Python applications for Raspberry Pi. The first application detects obstacles using GPIO input and notifies the user with printed messages. The second application reads and displays the environment temperature and humidity using a DHT11 sensor, while the third application captures and stores an image using the PiCamera module.

Uploaded by

James Waghmare
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

IOT Assignment Code

The document contains three Python applications for Raspberry Pi. The first application detects obstacles using GPIO input and notifies the user with printed messages. The second application reads and displays the environment temperature and humidity using a DHT11 sensor, while the third application captures and stores an image using the PiCamera module.

Uploaded by

James Waghmare
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Write an application to detect obstacle and notify user using


LEDs

import [Link] as GPIO


import time
[Link]([Link])
[Link](3,[Link])
try:
while True:
i= [Link](3)
if i==1:
print("No Obstacle")
[Link](0.1)
else:
print("Obstacle Found")
[Link](0.1)

[Link] an application to read the environment temperature.

import [Link] as GPIO


import dht11
import time

# initialize GPIO
[Link](False)
[Link]([Link])
#[Link]()

# read data using Pin GPIO21


instance = dht11.DHT11(pin=21)

while True:
result = [Link]()
if result.is_valid():
print("Temp: %d C" % [Link] +' '+"Humid: %d %%"
% [Link])
[Link](1)

[Link] an application to capture and store the image.

import picamera, time

camera = [Link]()

camera.start_preview()

[Link](5) # hang for preview for 5 seconds

[Link]('[Link]')

camera.stop_preview()

You might also like