Shop OBEX P1 Docs P2 Docs Learn Events
Switch Debounce Protection built in? — Parallax Forums

Switch Debounce Protection built in?

sciguysciguy Posts: 48
edited 2007-04-03 17:08 in BASIC Stamp
Does the Basic Stamp 2PE support switch debounce protection built in to the hardware? Or does it have to be accommodated for in the code?

Thanks

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-03 15:56
    Hello,

    That depends…If you’re using the BUTTON command for a single input you can handle debounce through the command. If you’re trying to read the switches some other way you will need to handle debounce. This has been covered in the Stamp Works Manual if you would like an example of debouncing multiple switches. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • sciguysciguy Posts: 48
    edited 2007-04-03 16:43
    I don't quite understand... I'm using a Vibration sensor, and It is either activated or not. However, I've amplified the signal, and I want to make sure it doesn't jump between rails and get the stamp confused. The amplification adds some noise.

    Here is the code:

    ' {$STAMP BS2pe}
    ' {$PBASIC 2.5}
    
    VibrationPin    PIN     15
    VibrationLEDPin PIN     11
    
    Slip:
    LOW VibrationLEDPin
    IF VibrationPin=0 THEN Slip
    HIGH VibrationLEDPin
    GOTO Slip
    
    
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-03 17:08
    There’s no confusion…As soon as it’s detected you can take action…There’s no need to debounce a vibration sensor. Just wait for the active state and jump to your handling routine. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.