Maker Pro
Maker Pro

Selector Button

Shaun101

Oct 24, 2015
1
Joined
Oct 24, 2015
Messages
1
Hi all,

I am new to this, so it may be an obvious answer.

I am building a circuit utilising microcontrollers and switches as well as 7 segment displays. What I want to be able to do is use a button/switch to select one of 3 options. Press once for option 1, press twice for option 2 etc. Also I want the different option numbers to be shown on the segment displays.

Can anyone point me in the right direction? I will be using Picaxe-18M2 for the programming if that helps.

Thanks
Shaun
 

ramussons

Jun 10, 2014
439
Joined
Jun 10, 2014
Messages
439
Since you want to count upto 3 (for the 3 options), you need to have a 2 bit binary counter whose output ( 00, 01, 10, 11) can be decoded to the chosen option. A CMOS chip 4511 should help you thru'.

http://www.doctronics.co.uk/4511.htm

Just ground the Inputs C and D.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
This can be done completely in software, no need to add an external counter.

You need to do the following:

1. Learn how to de-bounce a switch in software.
2. Make your program check for a new push of the switch periodically, with the period being 1/10th of a second or so.
3. Keep a variable that tells what mode you are in and cycle it to the next mode with each button press you detect.

Bob
 
Top