- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @MotooTanaka ,
I can toggle LED using NEC IR remote , But i want change toggled button without change in code. can you please help me how can i do it
Thanks ,
Mayur B.
Solved! Go to Solution.
- Labels:
-
PSoC 4 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I assumed that your question is adding LED toggle by an external button function
without breaking your working IR remote control.
So I created a simple sample using CY8CKIT-044, with a button (SW2: P0[7]) and LED (P2[6]).
If you are using P0[x] for IR input, use different port,
such as P1[x] ~ to avoid complicated interrupt handling may be a good idea.
Please also note that I did not pay attention to debounce of the button.
You may want to use a component debouncer to take care of it.
Schematic
Pins
main.c
#include "project.h"
#define LED_ON 0u
#define LED_OFF 1u
void toggle_led(void)
{
if (LED_Read() == LED_ON) {
LED_Write(LED_OFF) ;
} else {
LED_Write(LED_ON) ;
}
}
CY_ISR(button_isr)
{
button_ClearInterrupt() ;
toggle_led() ;
}
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
button_ClearInterrupt() ;
isr_1_StartEx(button_isr) ;
for(;;)
{
/* BLE Remote control part */
}
}
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mayur,
Is this thread with respect to any previous thread ? If yes kindly point us to that. Additionally could you elaborate your requirement ?
Best Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I assumed that your question is adding LED toggle by an external button function
without breaking your working IR remote control.
So I created a simple sample using CY8CKIT-044, with a button (SW2: P0[7]) and LED (P2[6]).
If you are using P0[x] for IR input, use different port,
such as P1[x] ~ to avoid complicated interrupt handling may be a good idea.
Please also note that I did not pay attention to debounce of the button.
You may want to use a component debouncer to take care of it.
Schematic
Pins
main.c
#include "project.h"
#define LED_ON 0u
#define LED_OFF 1u
void toggle_led(void)
{
if (LED_Read() == LED_ON) {
LED_Write(LED_OFF) ;
} else {
LED_Write(LED_ON) ;
}
}
CY_ISR(button_isr)
{
button_ClearInterrupt() ;
toggle_led() ;
}
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
button_ClearInterrupt() ;
isr_1_StartEx(button_isr) ;
for(;;)
{
/* BLE Remote control part */
}
}
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No , Sir .
I am talking about how can i change IR remote button for toggle the LED with out change in code .
Assume first i am toggling the LED using Button 1 from IR remote .
If i am press button 2 for long time example for 5 sec . LED should be toggle using button 2 .
it is possible ??