Question about RPS.
Exilict
Posts: 31
I am looking to write the following code, however I am stuck.· I know you guys will beat it out in second, so I figgured I would ask.
I have a switch, I need to measure how many times a second the switch is being activated. But it needs to have 2 different levels.
If the switch is activating 1· - 6 times a second I need to set a variable to 1
If the switch is activating 7+ times a second I need to set a variable to 3
However it needs to constantally monitor the switches/second.· If it drops under 7 it needs to change the var to 1, if it goes above 7 it needs to change the var to 3
The variable will be used in a loop to control the number of times a solenoid is activated.
Thanks,
·· Chris
I have a switch, I need to measure how many times a second the switch is being activated. But it needs to have 2 different levels.
If the switch is activating 1· - 6 times a second I need to set a variable to 1
If the switch is activating 7+ times a second I need to set a variable to 3
However it needs to constantally monitor the switches/second.· If it drops under 7 it needs to change the var to 1, if it goes above 7 it needs to change the var to 3
The variable will be used in a loop to control the number of times a solenoid is activated.
Thanks,
·· Chris
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
·· Will that freeze the program for the entire second?
I am also working on a switch / solenoid program.· Every time the switch is pulled I need it to activate the·solenoid 1 time, however if the switch is pulled more then·7 times a second I want it to activate 3·times for every pull.· The·switch and the pull need to operate·together.
The variable controls how many times the·"Activate" routine activates inside of a loop.
Thanks
·· Chris·
Post Edited (Exilict) : 11/9/2004 3:39:38 AM GMT
Wait unitl you get his BILL!
Bruce
Can one measure the time between one trigger pull and the next, then work from there? -- assuming that the trigger pulls are going to be at a fairly regular rate.· If the trigger pulls are about 142 ms or less apart, that would be seven pulls per second.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office