I had a arduino mega and a softpot rectilinear potentiometer (200mm).
I would like to know how should I get started. I read through some of the posts and understand that there are 3 pins (pin 1 to 5v, middle pin to analog input of arduino board, last pin to gnd). Is there any more things that I need to take care of?
Also, I cant find simple program that can be used to test the potentiometer. Is there any codes that I can try out?
I tried out the code but whenever i start running it for about 5 seconds, the arduino program hang and the serial monitor display funny symbols.
P.S: I removed the led parts in the code.
/*
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int sensorValue = 0; // value read from the pot
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(sensorValue);
// wait 10 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(10);
}
Soft pots do not have their wiper connected to anything when not pressed.
The solution is to use a pull down resistor on the analogue input, 100K to ground should be good. The only problem with this is you don't get the full range.