Compare commits
3 Commits
39fb6d2623
...
df44a69579
Author | SHA1 | Date | |
---|---|---|---|
df44a69579 | |||
3ff3c27e0a | |||
70baa3f8c1 |
BIN
Practical/Assignment-1/IoT - Arduino UNO R3 (Datasheet).pdf
Normal file
BIN
Practical/Assignment-1/IoT - Arduino UNO R3 (Datasheet).pdf
Normal file
Binary file not shown.
72
Practical/Assignment-1/IoT - Codes-1.py
Normal file
72
Practical/Assignment-1/IoT - Codes-1.py
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
"""
|
||||||
|
THIS CODE HAS BEEN TESTED ON RASPBERRY PI 3B AND IS FULLY OPERATIONAL.
|
||||||
|
|
||||||
|
Problem Statement: Understanding the connectivity of Raspberry-Pi / Arduino with IR sensor. Write an application to detect obstacle and notify user using LEDs.
|
||||||
|
|
||||||
|
Code from InternetOfThingsAndEmbeddedSystems (SPPU - Third Year - Computer Engineering - Content) repository on KSKA Git: https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems
|
||||||
|
"""
|
||||||
|
|
||||||
|
# BEGINNING OF CODE
|
||||||
|
# SINGLE LED ON/OFF
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO setwarnings(False)
|
||||||
|
GPIO.setup(12,GPIO.OUT)
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
print(“LED ON”)
|
||||||
|
GPIO.output(12,GPIO.HIGH)
|
||||||
|
time.sleep(1)
|
||||||
|
print(“LED OFF”)
|
||||||
|
GPIO.output(12,GPIO.LOW)
|
||||||
|
time.sleep(1)
|
||||||
|
except:
|
||||||
|
GPIO.cleanup()
|
||||||
|
|
||||||
|
##########
|
||||||
|
|
||||||
|
# TWO LEDs ON/OFF
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO setwarnings(False)
|
||||||
|
GPIO.setup(12,GPIO.OUT)
|
||||||
|
GPIO.setup(19,GPIO.OUT)
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
print(“LED ON”)
|
||||||
|
GPIO.output(12,GPIO.HIGH)
|
||||||
|
GPIO.output(19,GPIO.HIGH)
|
||||||
|
time.sleep(1)
|
||||||
|
print(“LED OFF”)
|
||||||
|
GPIO.output(12,GPIO.LOW)
|
||||||
|
GPIO.output(19,GPIO.LOW)
|
||||||
|
time.sleep(1)
|
||||||
|
except:
|
||||||
|
GPIO.cleanup()
|
||||||
|
|
||||||
|
##########
|
||||||
|
|
||||||
|
# BUZZER WITH ONE LED ON/OFF
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.setwarnings(False)
|
||||||
|
GPIO.setup(12,GPIO.OUT)
|
||||||
|
GPIO.setup(19,GPIO.OUT)
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
print("LED Buzzer ON")
|
||||||
|
GPIO.output(12,GPIO.HIGH)
|
||||||
|
GPIO.output(19,GPIO.HIGH)
|
||||||
|
time.sleep(1)
|
||||||
|
print("LED & Buzzer OFF")
|
||||||
|
GPIO.output(12,GPIO.LOW)
|
||||||
|
GPIO.output(19,GPIO.LOW)
|
||||||
|
time.sleep(1)
|
||||||
|
except:
|
||||||
|
GPIO.cleanup()
|
||||||
|
|
||||||
|
##########
|
||||||
|
# END OF CODE
|
BIN
Practical/Assignment-1/IoT - Raspberry Pi 4B (Datasheet).pdf
Normal file
BIN
Practical/Assignment-1/IoT - Raspberry Pi 4B (Datasheet).pdf
Normal file
Binary file not shown.
BIN
Practical/Assignment-1/IoT - Raspberry Pi 4B (Pinout).pdf
Normal file
BIN
Practical/Assignment-1/IoT - Raspberry Pi 4B (Pinout).pdf
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user