# Converting potentiometer value to time

Hello all. I am very new to this and while I really have tried poking around this site, Google, and YouTube, as a beginner the information is coming at me like a fire hose and it is a little overwhelming.

I want to make a relay timer that uses potentiometers to control the time the relay is energized from 0-10 seconds then a second for the delay in minutes from about 5-15 before the relay is energized again.

Seems simple enough.

I have watched several videos about potentiometers but usually the basic videos are either just watching a stream of numbers from 0-1023 scroll down a computer screen or dimming an led.

This is not a request for anyone to write code for me, but if anyone could offer suggestions for programming commands that I should be looking up and familiarizing myself with that would be helpful. I also understand that non-arduino pre-made timed relays are available for like \$8 on amazon but I would really like to use this project as a way to learn some programming not to mention dials are easier to manipulate than the push button interface many pre-made versions use.

Any suggestions on commands that you would use if you were making this? I don't need a full map but a compass direction or just a pointer in the right direction would be much appreciated.

I have watched several videos about potentiometers but usually the basic videos are either just watching a stream of numbers from 0-1023 scroll down a computer screen or dimming an led.

You can convert from 0-1023 to 0-10,000 milliseconds with the [u]map()[/u] function. (I assume your LED dimming example used map().)

Any suggestions on commands that you would use if you were making this?

I'll just try to get you started with this: The two most important concepts in programming are conditional execution (if statements, etc.) and loops (doing something over-and-over, usually until some condition is reached).

Once you understand those two concepts you can begin to understand how to write a program.

Another "trick" is to develop your code in small steps (one or two lines at a time), test-compiling and test-running as you go. It's also helpful to send little messages to the serial monitor so you can see the values of your variables and what your program is doing. i.e. You can make little messages that say "Turning LED on", or "Starting timer", or "Time's up", etc... Whatever you need to know or confirm.

In your program you can probably use delay(), but program execution pauses during delay() so you can't do anything (like read a pot) during the delay time. So eventually, you should learn how Blink Without Delay works. Using that technique, you can have several different delays/timers running at the same time, while you are also doing other stuff.

Awesome. This is exactly the kind of information I was looking for. Thank you!