Professional Documents
Culture Documents
Experimet 4 (IOT)
Experimet 4 (IOT)
Experimet 4 (IOT)
Explanation:
Circuit:
23
Flowchart:
Output:
24
(b) LED bilking without push button using Raspberry pi on Proteus using flowchart.
Explanation:
Circuit:
25
Flowchart:
(c) Flash an LED at a given on time and off time cycle, where the two times are taken
from a file.
Python Program:
To start, you need to make sure that your Raspberry Pi is connected to the internet. This is
needed to track time. Then type in this code:
pin = your_output_pin_here
GPIO.setup(pin, GPIO.OUT)
while True:
time = datetime.datetime.now().strftime("%H:%M")
26
if time == "12:00":
GPIO.output(pin, True)
time.sleep(number_of_seconds_for_led_to_be_on_here)
GPIO.output(pin, False)
time.sleep(0.030)
Replace things like 12:00 and your_output_pin_here with your own values. Every 30
milliseconds, it checks whether it is 12:00. If it is, it turns on the LED. It then waits a number of
seconds, then turns it back off.
27