Python code for Raspberry Pi 3 to glow LED on detecting obstacle | Team MAST

preview_player
Показать описание
In video I show how to connect an LED with Raspberry Pi 3, also I explain the python code to perform task after an obstacle is detected by the IR obstacle sensor which too is connected to Raspberry Pi 3.

This video is basically the continuation of my previous video (in which I explained you how to connect IR obstacle sensor with Raspberry Pi). Here in this video I first explain you how to connect an LED with Raspberry Pi 3 i.e which wire of an LED is to be connected to which pin of Raspberry Pi.

After we are done with the connection, I explain you simple python code line-wise which would perform some tasks (would print "Obstacle detected..!!" on console and would glow the LED) whenever an obstacle is detected.

The python code which I wrote is as follows
------------------------------------------------------------------------
import RPi.GPIO as IO
IO.setwarnings(False)
IO.setmode(IO.BOARD)
IO.setup(8, IO.IN)
IO.setup(3, IO.OUT)

while 1:
if(IO.input(8) == False):
print("Obstacle detected !!")
IO.output(3, True)
else:
IO.output(3, False)
---------------------------------------------------------------------------

Note - Before just using the above code, make sure to establish the connections in the same way as I did, i.e to which pins of Raspberry Pi did I connect IR obstacle sensor and LED and so forth.

If you had any of these queries
raspberry pi 3 python programming tutorial
Connecting LED with Raspberry Pi 3 B
raspberry pi 3 python projects
raspberry pi 3 python programming
raspberry pi 3 python coding
raspberry pi 3 python gpio tutorial
How to Write and Run a Python Program on the Raspberry Pi
Start programming on Raspberry Pi with Python
Programming GPIO example
Getting Started with the Raspberry Pi
raspberry pi python gpio
raspberry pi coding for beginners
Building an Obstacle Avoiding Bot Using Raspberry PI
How to Make an Obstacle-Avoiding Robot With Raspberry Pi
Detecting obstacle with IR (Infrared) Sensor Raspberry Pi 3
Boom you have landed to the perfect place, as this video will guide you in the best way possible.

In case you have any queries or concerns you can get back to me via the comment section below.

#RaspberryPi3 #PythonCode #LED #IRSensor #ObstacleSensor
Рекомендации по теме
Комментарии
Автор

GREAT WORK BROTHER. THIS HELPED ME TODAY

ROSH
Автор

Can u please tell me....what software is it to run the program ?

bygrace
Автор

Hi sir...can I know how to use ir sensor to detect saline level???

ganagesveeran
Автор

I want a code of ph sensor connect with raspberry pi

farhanmulla
welcome to shbcf.ru