Query

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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?

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

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.

View solution in original post

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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

0 Likes

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

0 Likes
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

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.

0 Likes
Anonymous
Not applicable

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

0 Likes
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

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.

pastedImage_0.png

Thanks,

P Yugandhar.

0 Likes