button switch ON-OFF & situation selector

Discussion in 'The Projects Forum' started by gatoulisss, Jan 31, 2015.

  1. gatoulisss

    Thread Starter Member

    Jan 23, 2015
    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!
  2. AnalogKid

    Distinguished Member

    Aug 1, 2013
    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.

  3. gatoulisss

    Thread Starter Member

    Jan 23, 2015
    yes i know but is there any idea about the code??
  4. jayanthd


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


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