TOUCH SENSOR LIGHT PROJECT

 VIDEO:



VIDEO LINK:

https://youtu.be/_L6CDi5Otzs

COMPONENTS REQUIRED:

1.TOUCH SENSOR

2.ARDUINO 

3.RELAY MODULE

4.JUMPER CABLES

5.AC BULB


CODE:

//Creative Pradeep//

//Touch Sensor Relay//


int touchPin = 2;

int relayPin = 3;


int val = 0;

int lightON = 0;

int touched = 0;


void setup() {

  Serial.begin(9600);

  pinMode(touchPin, INPUT); 

  pinMode(relayPin, OUTPUT);


}


void loop() {


  val = digitalRead(touchPin);


  if(val == HIGH && lightON == LOW){


    touched = 1-touched;

    delay(100);

  }    


  lightON = val;


      if(touched == HIGH){

        Serial.println("Light ON");

        digitalWrite(relayPin, LOW); 

       

      }else{

        Serial.println("Light OFF");

        digitalWrite(relayPin, HIGH);

   

      }     


  delay(100);

}


CIRCUIT DIAGRAM:


CHANNEL LINK:https://youtube.com/c/CreativePradeep


Comments

Popular posts from this blog

SMART WIFI CONTROLLED DOOR LOCK SYSTEM USING ESP32

ARDUINO PULSEOXIMETER