One button multiple functions
                    Hello all,
I have a project that I would like to convert to the propeller chip. My challenge is that I need to be able to control all the functions with a single switch.
The project is battery powered, and voltage is applied to the circuit when a multiple conductor cable is connected.
1st press turns the power on to the circuit
2nd press turns on a wireless receiver
3rd press ???
4th Press ???
Last press turns off the system if held for more than 3 seconds
I would like to be able to add addition functions to the button such as the ability to activate additional feature/cogs if needed.
Also I need a better way to monitor the current being drawn from the system. I am currently using a circuit that is attached.
If someone would like to see the code I am currently running I would be happy to provide it.
I am very new to the propeller, and just beginning to learn how to use it.
Thanks
Patrick
                
            I have a project that I would like to convert to the propeller chip. My challenge is that I need to be able to control all the functions with a single switch.
The project is battery powered, and voltage is applied to the circuit when a multiple conductor cable is connected.
1st press turns the power on to the circuit
2nd press turns on a wireless receiver
3rd press ???
4th Press ???
Last press turns off the system if held for more than 3 seconds
I would like to be able to add addition functions to the button such as the ability to activate additional feature/cogs if needed.
Also I need a better way to monitor the current being drawn from the system. I am currently using a circuit that is attached.
If someone would like to see the code I am currently running I would be happy to provide it.
I am very new to the propeller, and just beginning to learn how to use it.
Thanks
Patrick

                            
Comments
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
How about something like this...
loop: timer == 0 start timer on rising edge of button end timer on falling edge of button if timer > 100ms & timer < 2000ms button_state++ if button_state > 4, then button_state == 0 if buttonstate == 1 do function 1 elseif buttonstate ==2 do function 2 elseif buttonstate ==3 do function 3 elseif buttonstate ==4 do function 4 if timer > 2000ms turn_off repeat loopIt is proably the most inefficient way to do this but hey, im at work and my mind is numb :P
Alec
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
I will try this and let you know. Thanks for the info
Patrick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔