How do scan inputs to monitor for a state change?
samsn4
Posts: 49
I'm building an alarm and i want to scan the pins (about 10) for a state change, instead of a couple hundred if statements, is there a way to this more simplified? could i use a keypad object? (file attached). Next i need to store a number 0,1,2 and recall in later. ex.
pub start
check
if chk == 0
do this
if chk == 1
do this
if chk == 2
do this
pub check
this method checks all switches to be sure that they are in default state and not faulting, then returns a 0,1, or 2 depending on what is faulting
sorry if this is a bit muddy I'm a bit green and have only the basics down.
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Daniel Mueth
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Just plug it in and let's see what happens"
Post Edited (samsn4) : 8/28/2008 6:28:06 PM GMT
pub start
check
if chk == 0
do this
if chk == 1
do this
if chk == 2
do this
pub check
this method checks all switches to be sure that they are in default state and not faulting, then returns a 0,1, or 2 depending on what is faulting
sorry if this is a bit muddy I'm a bit green and have only the basics down.
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Daniel Mueth
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Just plug it in and let's see what happens"
Post Edited (samsn4) : 8/28/2008 6:28:06 PM GMT
Comments
One option may be using a CASE Statement and depending on what you are trying to do, another option may be using a Wait Unitl Pin Equal type of statement.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com·- Prop Blade, LED Painter, RGB LEDs, uOLED-IOC, eProto fo SunSPOT, BitScope
www.sxmicro.com - a blog·exploring the SX micro
www.tdswieter.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Daniel Mueth
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Just plug it in and let's see what happens"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Propeller Fire Alarm
http://forums.parallax.com/showthread.php?p=738436
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob