5 Replies Latest reply on Oct 30, 2017 11:29 AM by user_1377889

    SW2_Int

    user_496198631

      Hi everyone,

       

      I've got a little problem, i use one pin to detect two fronts, like that in a up front my variable take 1 , and on the down front my variable take 0.

      But that only works when the time between up&down are very small like 3/4min but i want it to work with a time between up and front of 1 Hour.

       

      Here is my code :

       

      CY_ISR (SW2_Handler)

      {

          if (SW2_Read()==0)

          {

              branchement=1;

              Pin_Green_Write(ON);

          }

          else if (SW2_Read()==1)

          {

             

              branchement=0;

              cycles=cycles+1;

              Pin_Green_Write(OFF);

            }

          SW2_ClearInterrupt();

      }

       

      Could you help me ?

       

      thanks