- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I'm working on CY8C4245AXI-483 MCU. I want to write a code to toggle LED through capsense touch button. it means, initially LED is OFF. now when i touch button it should be ON. and remains ON untill i touched it 2nd time. after touching 2nd time it should be in OFF condition and remains in OFF untill i touched it 3rd time and so on.
i found code for same, somewhere on internet. is this correct or i need to change something? Please give me your valuable suggestions.
Thanks & Regards,
Prem KB
/*code starts from here*/
uint fingerpresent_0 = 0;
uint8 wdgt_active = 0;
Solved! Go to Solution.
- Labels:
-
PSoC 4 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Esteem_123
Yes, this code will work as you require. You can try this out in any kit that has CapSense and LED.
Best regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Esteem_123
Yes, this code will work as you require. You can try this out in any kit that has CapSense and LED.
Best regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi @Hari ,
thanks for the reply. it works properly in my MCU. I have one more question.
Thanks & Regards,
Prem KB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi @Hari , Please find below Problem.
I have completed all hardware cydwr properly an TopDesign also. i'm facing difficulties in writting main.c. Please tell me what would be the code for doing this problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Esteem_123
Please let us know where you are facing issues. This looks like a simple implementation of CapSense. Note that we can help you out with any debugging or corner case issues that you might be facing but not with the implementation of the whole code.
To get you started, you can take a look at the CapSense_IsWidgetActive API for the UP and DOWN buttons. This API returns true whenever a particular button is pressed. This can be used to process the LEDs depending on which button is pressed.
Best regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, @Hari. actually I'm trying to implement the above code. i will look at the documentation as you suggested .
Thanks & Regards,
Prem KB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Although I totally agree with Hari-san, I wrote a sample project.
Since I don't have 4 LEDs on my CY8CKIT-042, I just let UART write "*", "* *", "* * *", "* * * *".
I hope that it won't be too difficult to write a program to turn on "real" LEDs in the lines of print("*\n\r") ;
This could be a spoiler, but having a sample to start with is not a bad thing when you (or we) are bewildered.
moto