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

PSoC™ 4 Forum Discussions

psco_3295286
Level 4
Level 4
10 likes given 5 likes given First like received

Hello, while trying to write a code for a simple capsense button, I am not able to find capsense_setparam, and such other keywords required for capsense pushbutton (It is not available in drop down list). Is it required to add any missing file or something like that?

Thanks in advance.

0 Likes
1 Solution

buch_nishad_3295286​ I did a demo on CY8CKIT-042. Use 3 CapSense buttons to control the RGB LED. Attached is the project.

KIT042.jpg

Thanks,

Ryan

View solution in original post

40 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Would be of interest which PSoC and which pcb/Kit you are using.

Additionally which CapSense component...

Bob

Sir, I am using psoc 4.2.And button0 capsense component.

0 Likes

OK, so you are using Creator 4.2, that's pretty good.

What is the code for your selected chip: CY8Cxxxx ?

And at last The version number of the capsense component v???

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

Sir, I am using capsense v2.60.

I have used the code from following : https://community.cypress.com/docs/DOC-14510

The screenshot is attached here.

Thank you.button.jpg

0 Likes

One of the first lines in the reference you provided shows the note: For Capsense version 3.0 or above...

This is why you do not find the required API.

Bob

Hi,

I think your project file using old CapSense version (under v3.0). After release CapSense v3.0 or later, the APIs are not compatible with under v3.0 version. So the problem is,

     - Implemented API (in main.c) - New CapSense API

     - Generated API - Old CapSense API

Please remove current CapSense component in TopDesign.cysch and drag down the CapSense v3.0 or later component. (You should change the component name to "CapSense"

pastedImage_0.png

Thanks,

Brandon

Hello,

As per suggestions from all of you, I was able to compile the code (same as in the screenshot) without error, but the led remains off in all conditions. May be still there is any mistake somewhere on my side.

I am trying to find out what is wrong and post the updated result.

Thank you.

0 Likes

Hello,

Still there is no progress and the led remains off in all conditions, as I said before.

Please help urgently.

Thank you.

0 Likes

Could you share your code with us?

Thanks,

Ryan

Can you please post your actual 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

Ok. The file is attached here.

0 Likes

Hello,

Awaiting response from community people.

Thank you.

0 Likes

Sorry for the delay, but here we have weekend.

I cannot see in main.c that you

  • Check for button is pressed
  • PWM is started
  • LED or PWM is changed to turn LED on or off

Bob

Sorry for disturbing in weekends.

Actually I copied the code from the forum. So I am assuming the code to be true and also that the line capsense_setparam(capsense_button0.......) is responsible for switching action.

What else is required in code?

Thanks you.

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Here is a simple Cap Sense button program. There is a PDF file in the zip file that explains the code. I am running PSoC Creator  4.2 (4.2.0.641)

rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

What Psoc CY8CKIT are you using.  If you are using the CY8CKIT-049-42XX then you would need to design your own CapSense Pad as this kit doesn't contain a Capsense Button in it's design.  I assume you are using this kit as you put a Bootloadable component on your schematic. Here is a link to Capsense design http://www.cypress.com/documentation/application-notes/an90071-cy8cmbr3xxx-capsenser-design-guide . You will need to follow this to design your Capsense button.

Yes I am using the same controller.

Ok. I will go through the link you have provided.

Thank you.

0 Likes

Hello Sir.

Still I haven't found solution.

How to design and implement the capsense pad in psoc coder?

Also, for the same controller and IDE, I am able to vary brightness of led with sliding finger but failed to use it as a button and switch the led on and off.

Kindly resolve my issue.

Thank you.

0 Likes

Here is another CapSense design guide.  http://www.cypress.com/file/41076/download . Please send a photo of your capsense button so we can check that you designed it correctly.

Here is a design that uses your Psoc kit and gives you an example on how to make the buttons. PSoC 4 : Making a 8 Pin Cap Slider for CY8CKIT-049 4200 Kit - Hackster.io

Here is the program it has been updated to the latest software release . The bootloadable points to my location you will need to change it to yours.

Sorry but I am getting an error "device.h - no such file or directory" for this workspace.

0 Likes

Clipboard01.jpg

Is it what you had asked for?

Also, the settings are the same as those in the workspace bundle I had uploaded previously.

Thank you.

0 Likes

That isn't the name of the program I sent you.  Are you unzipping to your computer to a new directory? Please work on the program I sent you.  Once you get it working then you can change it.  The heading on your Psoc Creator isn't the program I sent you.  I meant that you would need to point to your Bootloadable program for the boot loadable files. ..\SCB_Bootloader\UART_Bootloader.cydsn\CortexM0\ARM_GCC_493\Debug\UART_Bootloader.hex and bootloader.elf files.

Sir actually the screenshot is for the capsense button of my project that you asked for.

The error which I am getting is for the workspace you have sent.

I think by 'point to your bootloadable program', you mean I have to insert the project's .hex and .elf files in the dependencies option.

But Sir even then I am getting the error.

Now, I am attaching the screenshot of your project.

Please help.

Clipboard02.jpg

Thank you.

0 Likes

I tried the program that Psoc Creator generated and reloaded it on my computer and it failed to work and gives the same issue as you are seeing.  I will attempt to contact Cypress about this issue. Sorry for the issue.  You could try to download the file from the Hackster.io page and see if that one works for you, You need to update the program by selecting Project then Select update components.

Ok.

Please inform me as soon as you find the solution.

Yes, I updated the components but that didn't work either.

I will update here if I somehow manage to resolve the issue.

Thanks.

0 Likes

The latest code of this example can be downloaded through PSoC Creator->Find Code Example->CapSense_CSD_P4_Design

pastedImage_0.png

You can see the latest version number in the head of main.c

pastedImage_1.png

The obvious difference from user's view of point, is 'device.h' replaced by 'project.h'. It should be an optimization due to some update of PSoC Creator.

The latest version of the code is attached also.

Some web pages may not be updated timely, so that the project from website may be not the latest released...

Thanks,

Ryan

I forgot about this device.h and project.h changes Thanks for this help.

0 Likes

Hello.

I want to use the capsense as the button and not as a linear slider.

Also, I cannot find CapSense_CSD_P4_Design in code example.

Any help would be appreciated.

Thank you.

0 Likes

The example I gave you was for a reference to construct your own Capsense button. I know that it was for a slider but I wanted to show you how your button could be made from a copper and other materials.. Also a CapSense slider can be used as a button also.   I am still working with Cypress on the issue with the program changes after you make a Workspace bundle.

Thank you sir for your concern.

Can you just give an idea in brief about how to use it as a button, as you said that capsense slider can be used as a button?

0 Likes

Change the Capsense configuration to Button from Slider and it works.  You may have to run auto cal so that it sees your finger and acts a switch.

2018-06-10.pngJust click on Add button.

Sir I need a little more favour from you.

Yes, I know that we have to change from slider to button, but what part in the code should be changed as it shows error 'capsense_csd_linearslider0_ls undeclared' (as we have used button instead of slider)?

Where the auto cal is used?

Thanks.

0 Likes

Hello.

Still waiting for reply.

Please inform as soon as solution is found.

Thanks.

0 Likes

buch_nishad_3295286​ I did a demo on CY8CKIT-042. Use 3 CapSense buttons to control the RGB LED. Attached is the project.

KIT042.jpg

Thanks,

Ryan

Ok Sir.

I am yet to go through the code but when I loaded the .cyacd file, I finally managed to have led ON and OFF with the capsense pushbutton.

Thank you.

Thanks all for support.

Will get back to you people in future in case of difficuilty.

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Is there a reason Why you didn't use the code I posted to this Post?