Wednesday, 23 April 2014

Touch Sliders With A Softpot + Arduino

Softpot is a linear touch potentiometer, instead of turning a knob, you touch it and getting a value range from 0 - 1023.
Softpot potentiometer is  great for prototypes because you can tell where someone touched it.
In my project, GMIS, I will use two of those in order to create an interacting musical instrument for collaboarative music.

The arduino analogRead will vary between 0 and 1023 depending on where you touch it, (1023 when not being touched) and is linear, so it will be about 515 - 525  if touched in the middle.






Arduino code:



int softpotPin = A0; //analog pin 0

void setup(){
  digitalWrite(softpotPin, HIGH); //enable pullup resistor
  Serial.begin(9600);
}

void loop(){
  int softpotReading = analogRead(softpotPin); 

  Serial.println(softpotReading);
  delay(250); //just here to slow down the output for easier reading
}


 

No comments:

Post a Comment