Rajat Naruka
Published © GPL3+

Touch sensor

In this project, we will use touch sensor to detect touch and will switch on the LED on touch.

IntermediateProtip863
Touch sensor

Things used in this project

Schematics

El5WhudsicIjqUTOD00O.JPG

Code

touch sensor

Java
int ledpin=8;
int threshold_value=400;



void setup() {
  Serial.begin(9600);
  pinMode(ledpin,OUTPUT);
  pinMode(buttonpin,OUTPUT);
  // put your setup code here, to run once:

}

void loop() {
 int sensorvalue=analogRead(A0);
 Serial.println(sensorvalue);
 if(sensorvalue>threshold_value)
 digitalWrite(ledpin,HIGH);
 delay(200);
 digitalWrite(ledpin,LOW);

 
 }
  // put your main code here, to run repeatedly:

Credits

Rajat Naruka

Rajat Naruka

8 projects • 1 follower

Comments