Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
nolanrfoster
Published © GPL3+

Arduino Touch Sensor

Find out how to control a led with a touch sensor

BeginnerFull instructions provided540
Arduino Touch Sensor

Things used in this project

Story

Read more

Schematics

Diagrams

Code

code

C/C++
int switchstate = 0;

void setup() {

  pinMode(3, OUTPUT);
  pinMode(2, INPUT);
}

void loop() {


  switchstate = digitalRead(2);

  if (switchstate == HIGH) {
    digitalWrite(3, HIGH); 
  }
  else {
    digitalWrite(3, LOW);  
  }
}

Credits

nolanrfoster
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.