1 2 3 Previous Next 37 Replies Latest reply on May 1, 2013 5:03 AM by user_14586677

    Capsense on-off button

    salim.ylmaz

       Hi,

         

      I am using CY8CKIT-001 - CY8CKIT-009. I have a problem.I want to use it as a single on-off capsense button. So when I press the button once will light up led,later I press the same capsense button again will turn off led. I use the following code:

      if( statusButton0 == ON && onoff==0)

      LCD_PrintString("On ");
      Led1_Write(0x01);
      onoff=1;
      }


      LCD_Position(1,3);
      if( statusButton0 == ON && onoff==1)


      CyDelay(200u);
      LCD_PrintString("On");
      onoff=0;
      Led1_Write(0x00);
      }

      I do not know what I'm doing wrong but Led is flashing. Do you have a software error or hardware error? Thanks your answers.

        1 2 3 Previous Next