Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
nolanrfoster
Published © GPL3+

Arduino Touch Sensor

Find out how to control a led with a touch sensor

BeginnerFull instructions provided537
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

nolanrfoster

1 project • 0 followers

Comments