Turn-on the light using Touch Sensor

12:54 PM 11 Nov, 2019
  • 1
  • 1
  • 0

This project helps you learn the basics of touch sensors and its function. Let us turn on the LED using a touch sensor

#include <Arduino.h>

void setup(){
    pinMode(10,INPUT);
    pinMode(13,OUTPUT);
}

void loop(){
    if(((digitalRead(10))==( 1 ))){
        digitalWrite(13,1);
    }else{
        digitalWrite(13,0);
    }
    _loop();
}

void _delay(float seconds){
    long endTime = millis() + seconds * 1000;
    while(millis() < endTime)_loop();
}

void _loop(){
}