3 Replies Latest reply on Jul 8, 2018 3:24 AM by bob.marlowe

    Why is the RGB LED not turning on when used out of for loop?

    DheerajDake

      Hello,

      I have setup a PSOC6 project using CY8CKIT-062-WiFi-BT as my device. I have configured a digital PIN and assigned P0_3 to it. P0_3 maps to RED LED in RGB from schematics. I am able to blink the LED when used in for loop but not outside of it.

       

      In main_cm4.c,

       

      The following is working:

       

      int main(void)
      {
           for(;;)
           {
              Cy_GPIO_Write(LED_R_PORT, LED_R_NUM, 1);
              CyDelay(500);
              Cy_GPIO_Write(LED_R_PORT, LED_R_NUM, 0);
              CyDelay(500);
           }
      }
      

       

      But this is not turning the LED on.

       

      int main(void)
      {
           Cy_GPIO_Write(LED_R_PORT, LED_R_NUM, 1);
           for(;;)
           {
           }
      }
      

       

      Why?

       

      The GPIO is configured as Digital output with no hardware connection. The initial drive state is low.

       

      Thanks

      Dheeraj