Arduino_Scuola
Published © GPL3+

Soft potentiometer tutorial

This tutorial will show you how to use the Soft Potentiomenter produced by plug and wear.  

BeginnerFull instructions provided15 minutes3,676
Soft potentiometer tutorial

Things used in this project

Hardware components

Arduino LilyPad USB
Arduino LilyPad USB
×1
Soft potentiometer kit
×1

Story

Read more

Code

Code snippet #1

Arduino
int sensorPin = A5;    // select the input pin for the potentiometer
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
32 projects • 156 followers

Comments