Introduction: Super Fast Super Easy Metal/Mental Touch Sensor Guide!

Wondering how to use a metal or touch sensor with an Arduino? Well, we've got your back!

Step 1: Type in Code!

Type in the following code.

const int SensorPin=7;

//const int SensorPin=7;

//Level input ports

const int analogIn = A0;

const int ledPin = 13;

int SensorState=0;

int analogVal = 0;

void setup()

{ pinMode

(SensorPin,INPUT);

pinMode(ledPin,OUTPUT);

} void loop()

{ analogVal = analogRead(analogIn);

SensorState=digitalRead(SensorPin);

if(SensorState==HIGH)

{ digitalWrite(ledPin,HIGH);

} else { digitalWrite(ledPin,LOW); }

} const int analogIn = A0;

const int ledPin = 13;

int SensorState=0;

int analogVal = 0;

void setup()

{ pinMode(SensorPin,INPUT);

pinMode(ledPin,OUTPUT);

} void loop()

{ analogVal = analogRead(analogIn);

SensorState=digitalRead(SensorPin);

if(SensorState==HIGH)

{ digitalWrite(ledPin,HIGH);

} else { digitalWrite(ledPin,LOW);

}

}

Step 2: Upload to Arduino!

Upload using the upload button on the window.

Step 3: Begin Wiring.

Analog to A0, GND to ground, 5V to 5V, and pin to 13. DONE!

Step 4: Admire Your Working Sensor!

Check your console for it detecting stuff. Good job, you now know how to use a metal/mental sensor! Good luck with application to other things!

Electronics Tips & Tricks Challenge

Participated in the
Electronics Tips & Tricks Challenge