Go Down

Topic: Rotary Shaft Encoder to Control Timer (Read 907 times) previous topic - next topic

GUNN

Apr 02, 2012, 05:40 pm Last Edit: Apr 02, 2012, 05:42 pm by GUNN Reason: 1
Hello, Im very new to Arduino!

I have a two channel rotary shaft encoder and an LCD screen (16 X 2 used in 4 bit mode like the basic examples). I wish to display a timer on the screen (hours, minutes, seconds), set the time using the shaft encoder (turn clockwise to increase time, turn anti-clockwise to decrease time) in 5 second increments and when the timer times down from the programmed time and reaches 0, I wish to set a digitial pin high for a second and then reset the timer to the programmed time.

If possible it would be useful to increment the time in 5 second steps when the encoder is turned slowly and in 30 second increments if the encoder is turned quickly.

I really do not know where to start unfortunately, I have searched the forums and read various examples of timers and loaded some libraries to my IDE but I cannot find an example with the functions I need.

Any help would be appreciated :)

liudr

Oh, welcome!


If possible it would be useful to increment the time in 5 second steps when the encoder is turned slowly and in 30 second increments if the encoder is turned quickly.


I suggest you leave this part to your fingers. You will find you can turn fairly fast with just two fingers. If you try to program some type of logic it will feel unpredictable.

I recommend you download my library for the encoder and menu system here:

http://code.google.com/p/phi-prompt-user-interface-library/downloads/detail?name=libraries.zip&can=2&q=

Go through this example code to see how the up and down can be sensed.

phi_rotary_encoders_example_01

GUNN


Oh, welcome!


If possible it would be useful to increment the time in 5 second steps when the encoder is turned slowly and in 30 second increments if the encoder is turned quickly.


I suggest you leave this part to your fingers. You will find you can turn fairly fast with just two fingers. If you try to program some type of logic it will feel unpredictable.

I recommend you download my library for the encoder and menu system here:

http://code.google.com/p/phi-prompt-user-interface-library/downloads/detail?name=libraries.zip&can=2&q=

Go through this example code to see how the up and down can be sensed.

phi_rotary_encoders_example_01


Thankyou! I will give this a go

GUNN

Does anyone have any suggestions on how to couple the shaft encoder with a timer code?

liudr

Hey,

I got your message the other day but I was a bit unsure which line of code you want help with. There are only few lines. Let me know which line.

For timer code, you can look at my user interface library I have here:

http://liudr.wordpress.com/libraries/phi_prompt/

The examples are mostly done with push buttons or matrix keypads but you can substitute with rotary encoder easily.

Go Up