- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to have the LED stay on for 5 seconds after I push the button on the cy8ckit-049-42xx prototyping kit.Currently, it works the first time I push the button but the next time the LED stays on forever. I am using Win 7 and PSoC Creator 4.1.
Here is the relevant code.
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
My_Timer_Enable();
int Flag = 0;
//LED_Write(1);
for(;;)
{
LED_Write(0);
if(!SW2_Read() && !Flag)
{
My_Timer_Start();
Flag = 1;
}
while((My_Timer_ReadCounter()>0)&&Flag)
{
LED_Write(1);
CyDelay(100);
}
if(My_Timer_ReadCounter()<1)
{
Flag=0;
// My_Timer_Init(); // Makes no difference
}
}
}
I have attached the code bundle.
Thank you for your kind help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That does not work because the timer will be reloaded after TC.
See attached project (I used a different PSoC, please change it back.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content