ARDUIN WITH TOUCH SENSOR

In this tutorial you will get to know that how you can create a touch detection system .




Material requirements are given below :-
  • ARDUINO
  • TOUCH SENSOR
  • GREEN LED
  • RED LED
  • BRAEDBOARD
  • JUMPER WIRES
Working
Whenever you touch any finger on the sensor red LED starts glowing making you alert.
Otherwise green LED glows indicating no touch.


CONNECTIONS
ARDUINO
GND          =     -ve of green , red LED and
                          GND of touch sensor
5V              =     VCC of touch sensor
2                =      +ve of red LED
3                =      +ve of green LED 
4                =      SIG/OUT of touch sensor


CODE OF THE PROJECT :-

const int touch = 4;
const int green = 3;
const int red = 2;

void setup() {
pinMode(touch, INPUT);
pinMode(green, OUTPUT);
pinMode(red, OUTPUT);
}


void loop() {
if(digitalRead(touch) == HIGH){
  digitalWrite(green,LOW);
  digitalWrite(red,HIGH);
}


else{
  digitalWrite(green,HIGH);
  digitalWrite(red,LOW);
 
}
}


       

Popular posts from this blog

ARDUINO WITH PCA9685

TELEGRAM WITH RASPBERRY PI