edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
Rahul Bhatia
Published © GPL3+

Touch Sensor

When the touch sensor is activated, the LED will turn on.

BeginnerShowcase (no instructions)10,704
Touch Sensor

Things used in this project

Code

touch sensor code

Java
led will turn on when we will touch the sensor
int ledPin =8;
int thresholdValue=400;
void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode(ledPin,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
int sensorValue=analogRead(A0);
Serial.println(sensorValue);
if(sensorValue>thresholdValue)
digitalWrite(ledPin,HIGH);
delay(200);
digitalWrite(ledPin,LOW);
}

Credits

Rahul Bhatia
8 projects • 0 followers
Btech student 3rd year

Comments