2 Replies Latest reply on Oct 23, 2015 6:44 AM by dturney_1462731

    BLE_IAS with 2 button toggle function

    dturney_1462731

      I'm working to modify the Central/Peripheral code from 100 Project-100 Days, and would like to add a Pin Input/another button.  So, I'm trying to figure out how to use the same software debouncing method, interrupt, and DeepSleep functions, yet have each button change the alert variable a different way.  One button will hop between Mild- and Full-Alert, while the second button will hop between No Alert and the last alert prior to button 2 was pressed, like a quick bypass.  I have attached the Central code, and so far I've gotten it to connect to the peripheral, but no button functionality afterward.  Any insight would be appreciated, and since the button reads is the only thing needed, I wouldn't be opposed to using Debounce either, if necessary.

        • 1. Re: BLE_IAS with 2 button toggle function
          bmah

          Hi,

             

          The switches are connected to pins P2[3] and P2[4]. Can you change the drive mode from Strong Drive to Resistive Pull-Up? Also how are you interfacing these switches?

          • 2. Re: BLE_IAS with 2 button toggle function
            dturney_1462731

            Thank you and sorry for the last response.  I have changed the drive mode.  I can get the functionality, as far as reading a button press, but I'm looking for a way to software debounce both buttons.  I don't know if I need to have 2 different CheckButtonStatus functions and/or 2 different sets of variables, etc, or if there's a way to have one function check both buttons then debounce one that is presses with a different result, ie if (button1) {iasAlert = 0}, if (button2){iasAlert = 1 or 2}.  I would rather use a hardware debounce, but this app will probably use EZ or PRoC.