Pages: [1]   Go Down
Author Topic: Rotary Shaft Encoder to Control Timer  (Read 690 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
« Last Edit: April 02, 2012, 10:42:11 am by GUNN » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 65
Posts: 6937
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 65
Posts: 6937
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Pages: [1]   Go Up
Jump to: