Arduino_Scuola
Published © GPL3+

Analog Textile Press Button Tutorial

How to read the value of a Analog textile press button with your Arduino.

BeginnerFull instructions provided15 minutes3,426
Analog Textile Press Button Tutorial

Things used in this project

Hardware components

Arduino LilyPad USB
Arduino LilyPad USB
×1
Analog textile press button
×1

Story

Read more

Code

Code snippet #1

Arduino
int sensorPin = A5;    // select the input pin for the sensor
int ledPin = 13;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor
 
void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);
}
 
void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  // turn the ledPin on
  digitalWrite(ledPin, HIGH);
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);
  // turn the ledPin off:
  digitalWrite(ledPin, LOW);
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);
}

Credits

Arduino_Scuola

Arduino_Scuola

32 projects • 155 followers

Comments