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);
}
Touch Sensor
When the touch sensor is activated, the LED will turn on.




_ztBMuBhMHo.jpg?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)
Comments