[PIC] reed switch and uses (mode selection)

Status
Not open for further replies.

gatoulisss

Junior Member level 2
Joined
Feb 5, 2015
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,474
hello guys, i want to use a reed switch like an on/off switch but also as selector.
i have connected it in a pull up resistor and to a pic16f88 port. the use i want to make for example is 3sec the magnet to the switch then system on if i release and put the magnet again for 3 sec there then it is becoming off, but if i dont release then after 4 sec (3-on+1) then is selecting mode A, 5 sec (3-on+2) then is selecting mode B and 6 sec (3-on+3) then is selecting mode C till i release. in the system program im checking a sensor and is in 4 mode silent (on state) 15sec ring (mode A) 30sec ring (mode B) and last 60 sec ring (mode C)
i have problem in ho to use the on-off and the mode selector code... any help with it?
 

To do this analog fashion, you can start charging a capacitor when you press the switch. Apply its rising volt level to a 3914 IC (bargraph). The output pins will go through your various choices, in sequence one at a time.
 

there isnt any way with the delay? for example
for (; {

if (porta.f1==0){
on=1;
delay_ms(3000);
if (porta.f1==0 && on==1) {
.....
...
}

something like this?
 

Sorry, don't know the syntax of that programming language.

It's a good idea to display what is the potential choice at each moment. That is, what you would select if you let up the switch.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…