3 Types of LED Blinking

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

cross mob
lock attach
Attachments are accessible only for community members.
JuIn_1625121
Level 5
Level 5
100 sign-ins First solution authored 100 replies posted

This is sample project for CY8CKIT-041-40XX.

Each time SW2 is pressed, the following three methods are switched.

BLUE LED : Firmware

GREEN LED : PWM

RED LED : WDT w/interrupt

In this project, I roughly control the functions.

It would be interesting to control whether or not each function works and measure the current consumption.

0 Likes
1 Reply
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

Thank you for provide a sample project.

I tried with my CY8CKIT-145-40XX board.  Please let me add some comments.

Out of the reset, the WDT interrupt is running behind the firmware.  So, the blinking period is quite strange.  It is better to disable the WDT at the beginning of the main loop like...

    CySysWdtDisable();

    isr_WDT_Stop();

   

    for(;;)

    {

You mentioned about current consumption.  But the firmware main loop is executing CySleep() regardless of the ledState.  It is recommend to stop the CPU for PWM and WDT states.

        /* Place your application code here. */

        if (ledState == FW) {

            BLUE_LED_Write(~(BLUE_LED_Read()));

            CyDelay(1000);

        } else if (ledState == PWM) {

            CySysPmSleep();

        } else {

            CySysPmDeepSleep();

        }

I don't think this is a best solution.  It is better to write all control logics in the main lop not in the ISR.

Regards,

Noriaki

0 Likes