button switch ON-OFF & situation selector

Thread Starter

gatoulisss

Joined Jan 23, 2015
69
hello guys!
i want to use a button as switch but not only...
for example when i press it for 3sec then this becomes ON and if i press it again for 3sec then OFF, this is the easy part. the problem is that the ON situation is like a locator whitch use a piezo buzzer that sound every 15 or 3o or 60sec time tha i select from the same button.So the button work is: 3sec press=on, 6sec press=every 15sec buzzer ring time, 8sec press=every 30sec buzzer ring time, 10sec press=every 60sec buzzer ring time and if i release it and press it again for 3 sec then it becomes off if i dont release it then it start again the selection between ring times...
any help with the code?
im using mikro C and pic16f88

thanks a lot!
 

AnalogKid

Joined Aug 1, 2013
11,044
Those are looooong button press times. Another approach is to press the button multiple times within a certain time period to select the functions. For example, press the button twice within 1 second gets function 1. Pressing 3 times within 1 second gets function 2. etc. I did this long ago with a gated 4017 decade counter.

ak
 

Thread Starter

gatoulisss

Joined Jan 23, 2015
69
Those are looooong button press times. Another approach is to press the button multiple times within a certain time period to select the functions. For example, press the button twice within 1 second gets function 1. Pressing 3 times within 1 second gets function 2. etc. I did this long ago with a gated 4017 decade counter.

ak
yes i know but is there any idea about the code??
 

jayanthd

Joined Jul 4, 2015
945
Hi mods, I know this is an old thread but I just want to help that person.

@gatouliss

Do you still want a code for your project ? I only code in C.
 
Top