craigwb
- 4th November 2011, 07:50
Hi All
Can someone Please help me with a Toggle or Latching switch State that I am battling with and not getting right.
I have 6 Toggle switches (Float Switches in a tank) which i need to read the state of all the time 0 or 1. They are either 0 or 1, one can be triggered or more than one together. I have setup my code and can read a standard momentary switch but, I cannot seem to read a latching switch, What I mean is I can read the switches but, I have a problem when they are latched in a fixed position either 0 or 1 for a long period of time.
How do I only read the switch once and ignore it until it changes state and then only read it once again and ignore it until it changes state later on. What I also need to do is trigger a 433mhz Transmitter only once with the updated info on the switches and then let the Tx sleep until another update is ready to be sent.
If you could Please help and if you maybe have some sample code I am sure that I will be able to figure it out?
I am still fairly new to programming!
Kind Regards
Craig
Can someone Please help me with a Toggle or Latching switch State that I am battling with and not getting right.
I have 6 Toggle switches (Float Switches in a tank) which i need to read the state of all the time 0 or 1. They are either 0 or 1, one can be triggered or more than one together. I have setup my code and can read a standard momentary switch but, I cannot seem to read a latching switch, What I mean is I can read the switches but, I have a problem when they are latched in a fixed position either 0 or 1 for a long period of time.
How do I only read the switch once and ignore it until it changes state and then only read it once again and ignore it until it changes state later on. What I also need to do is trigger a 433mhz Transmitter only once with the updated info on the switches and then let the Tx sleep until another update is ready to be sent.
If you could Please help and if you maybe have some sample code I am sure that I will be able to figure it out?
I am still fairly new to programming!
Kind Regards
Craig