Arduino : Light ON One By One Following Foot Steps on Staircase

We can reverse the action i.e. TURN ON LED facing obstacle by minimum modification :

Vim

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

int LED=13;

int obstaclePin=7;

int hasObstacle=HIGH;

void setup(){

pinMode(LED,OUTPUT);

pinMode(obstaclePin,INPUT);

}

void loop(){

hasObstacle=digitalRead(obstaclePin);

if(hasObstacle==HIGH)

{

digitalWrite(LED,HIGH);

}

else

{

digitalWrite(LED,LOW);

}

delay(200);

}

With Arduino, We Can Turn Light ON One By One Following Foot Steps on Staircase or Hallway. So As the Person Leave a Position, Light Turns Off. That is possible if we use multiple IR Obstacle Detection Sensors and multiple LEDs as model and in real, instead of LED, AC light with relay module.

With four IR Obstacle Sensors and 6 LEDs, circuit diagram is practically same like older guide. Only each LED and IR will use different pins.

With four IR Obstacle Sensors and 6 LEDs, our code will go like this :