6 Replies Latest reply on Oct 1, 2018 2:48 AM by PY_21

    Query

      I'm using psoc 4 ble kit.

      I want to use the button on p2.7

      I have defined it in the design

      My queries are -

      How do i access it?

      What will be the values received when pressed and not pressed?

      From which function do i get the output values of the button when pressed and not pressed?

        • 1. Re: Query
          JoMe_264151

          You should define your input pin as "Resistive pull up" with "initial drive state" high (1)

          When the switch is pressed you will read with PinName_Read() API a zero (0) value.

           

          Bob

          • 2. Re: Query

            Hello sir,

            I have mentioned the switch as u mentioned

            I tried a project where if the button is pressed it should print "BUTTON PRESSED" in uart , red led should glow and 1 should be notified in the cysmart app

            If not pressed red led should not glow and 0 should be notified in the cysmart app

            Don't know where I have gone wrong

            I'm attaching the project

            Please go through it

            • 3. Re: Query
              JoMe_264151

              Can you please post your complete project so that we all can have a look at all of your settings. To do so, use

              Creator->File->Create Workspace Bundle (minimal)

              and attach the resulting file.

               

              Bob

              • 4. Re: Query
                PY_21

                Hello,

                 

                Please refer the below modified project, in which when we enable the notify in CySmart App and if the button is pressed then 1 should be notified in the cysmart app, it will print "BUTTON PRESSED" in uart and red led will glow. If not pressed red led should not glow and 0 should be notified in the cysmart app.

                If we stop the notify in CySmart App then no operation will happens.

                 

                Thanks,

                P Yugandhar.

                • 5. Re: Query

                  Thank you sir

                  I have another doubt

                  The values sent 0 and 1 receive as strings or integers in the cysmart app or any another ble supported app?

                  Thanks,

                  Harshith

                  • 6. Re: Query
                    PY_21

                    Hello,

                     

                    In the above attached project, the values sent 0 and 1 received as integers. We can send strings of data by changing the characteristic value type in the BLE Component as shown in attached image.

                     

                    Thanks,

                    P Yugandhar.