This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Pin Monitoring by Creating New Task

Hello Everyone,

I need to continuously monitor a Pin (for HIGH/LOW) of the micro controller without using external interrupt and I want to implement this in HA Zstack.

Here shall I need to create a new task? If yes how should I do it?

Can anyone help me with this problem?

  • You need to create a new event to do this not a new task. You can refer to SAMPLELIGHT_IDENTIFY_TIMEOUT_EVT in SampleLight project to see how to create a event.

  • Sir this event created will occur only after Samplelight event occurs and will be restricted for particular period of time.

    I need to monitor a pin continuously, as I would be taking decision based on this pin.
  • It shows you how to create event. You can refer the following codes to generate periodic event every 10 seconds.

    //Put where you want to start SENSOR_READ_EVT
    osal_start_timerEx( zcl_XXX_TaskID, CHECKPIN_EVT, 100 );

    //Create CHECKPIN_EVT processing in zcl_XXX_event_loop
    if( events & CHECKPIN_EVT )
    {
    //you can check pin status here!
    osal_start_timerEx( zcl_XXX_TaskID, CHECKPIN_EVT, 10000 );
    return (events ^ CHECKPIN_EVT);
    }