float and microswitches

hi

I have a float switch which is an open circuit when the fluid level is low, and therefore when the fluid is full the circuit is closed.

One wire on the float is connected directly to 5 volt, while the other wire connects to an input of a picaxe.

There is also a 10K resistor to pull low to prevent the input from floating

When the fluid boils the float switch rapidly bounces causeing it to go high and low.

Will this damage the picaxe in anyway?

also I am using some microswitches that are held open when something pushes them. What I have noticed is that because the switch is activated the program cycles continuously until it is clear of the switch.

Can someone give me a snippet of code that will something to happen once and then maybe reset after a duration of time

regards
michael
 

Dippy

Moderator
Assuming I have understood correctly, no it won't hurt the PICAXE.
This assumes there is no reactive or noise content to the signal from the switch.
Though I'm sure the continuous clickety-click of the poor old microswitch will reduce it's life.

As far as the switch function question is concerned I'm not 100% sure what you are describing.
"What I have noticed is that because the switch is activated the program cycles continuously until it is clear of the switch."
- Until WHAT is "clear of the switch"?
- A program can only cycle if you have written it like that.
Post the crucial part of your code and can you just clarify what I asked about above please.

Generally, if you want something to happen once and then move on you test a condition and then set a flag.
You can then use another test or a manually derived timeout to reset the flag or you can use timer interrupts if you wish an absolute time.
 
Top