Jugaadu's father works in an office which has many employees. Every day his father faces a problem in parking his vehicle as usually he doesn't know whether a particular parking space is occupied or not. Jugaadu wants to help his father. So let us help Jugaadu as well?
Bag Items:
int LED = 13;
int obstaclePin = 7;
int hasObstacle = HIGH;
void setup() {
pinMode(LED, OUTPUT);
pinMode(obstaclePin, INPUT);
Serial.begin(9600);
}
void loop() {
hasObstacle = digitalRead(obstaclePin);
if (hasObstacle == LOW)
{
Serial.println("Stop something is ahead!!");
digitalWrite(LED, HIGH);
}
else
{
Serial.println("Path is clear");
digitalWrite(LED, LOW);
}
delay(200);
}