/*
* http://arduspot.blogspot.in/p/ir-sensor_12.html
*
* IR SENSOR ARDUINO UNO
* O/P 5
* VCC 5V
* GND GND
*/
int ir = 5; //pin in arduino
int i; // variable to store ir sensor output
void setup()
{
pinMode(ir,INPUT);
Serial.begin(9600);
}
void loop()
{
i = digitalRead(ir);
if(i == 0)
{
Serial.println("Absence of obstacle");
}
else
{
Serial.println("Obstacle Detected");
}
}
No comments:
Post a Comment