I'm working on a Hair brush project based on ATmega328. It is supposed to have a button which when pressed once will turn on the hair brush and set it to the least vibration mode, when the same key is pressed again the hair brush will be set on medium vibrating mode and when the same key is pressed thrice it will be set to highest vibrating mode. But if I long press and hold this button the hair brush should turn OFF. Something like cellphone. The hair brush is battery operated.
How this can be achieved? I have no idea where to start. I can handle the vibration mode stuff but this ON and delayed OFF thing, how to do it?
Thanks in advance