 # Scrolling through images with potentiometer, is it possible?

I have got RFID tags to load images and a song. I want to be able to scroll through the images using a potentiometer, how would I go around in doing that ?

Cheers

Using a pot and an analog input you can get a value from 0 to 1023. You can map those values directly to an image index and show that image or you can use the pot value to select how quickly to scroll and in which direction: values near 512 would stop the scroll. Values dropping below 512 would scroll left at an increasing rate and values increasing above 512 would scroll right at an increasing rate.

Thanks for getting back, Is there a place you can point me in specific to this, I'm new with Potentiometers.

Cheers

This tutorial tells you how: http://www.arduino.cc/en/Tutorial/Potentiometer

(I found that by Googling for Arduino Potentiometer)

Appreciate the sarcasm.

(expanding john’s proposal)

First thing to do is to map the potentiometer to e.g. -10 …+10. By using a smaller range you will get rid of noise of the analogRead() function.

(partial code to get the idea)

``````void loop()
{
int speed = analogRead(A0) / 50; // gives a value of 0..20
speed = speed - 10; // gives a value of -10 .. +10

if (speed < 0) image = image -1;
else if (speed > 0) image = image +1;

show(image);

if (speed != 0) delay(1000/speed);  // The higher the speed the shorter the delay but beware of divide by zero.
}
``````