Try to implement LED Blinky on Matter Template Example code.

I want to modify the example code which is provided by Matter SDK and there are several examples are there are Light bulb example code, Light Switch example code and Template code as well. Now I just right now simply wants to understand the code and modify it.


But it very complex to understand the code so can you please provide or explain the basic flow of Template like how it works. 

And also, I want to modify that code want to do some practical's like blink an LED but i did not know exactly where in that code I have to Change.

Please your help will be appreciated. 

Parents
  • Hi,

    I recommend taking a look at Adding clusters to Matter application. The part about using the ZAP tool to add clusters and attributes is not relevant for your question, but section 3 and 4 where you modify and add code are.
    The main takeaway is that you have events (in AppEvent) which are added to a queue when they happen. When an event is first in the queue and should be handled, the corresponding handler will be called. For example, you have the ButtonEvent which is added to the app event queue when a button is pressed. When it is time for this event to be handled, the function ButtonEventHandler() is called, where you can add code for what you want to happen when a specific button is pressed.

    And also, I want to modify that code want to do some practical's like blink an LED but i did not know exactly where in that code I have to Change.

    This depends on when you want the LED to blink. If you want it to blink regularly you could create use a timer similar to sFunctionTimer, and then toggle the LED in the callback.

    Best regards,
    Marte

Reply
  • Hi,

    I recommend taking a look at Adding clusters to Matter application. The part about using the ZAP tool to add clusters and attributes is not relevant for your question, but section 3 and 4 where you modify and add code are.
    The main takeaway is that you have events (in AppEvent) which are added to a queue when they happen. When an event is first in the queue and should be handled, the corresponding handler will be called. For example, you have the ButtonEvent which is added to the app event queue when a button is pressed. When it is time for this event to be handled, the function ButtonEventHandler() is called, where you can add code for what you want to happen when a specific button is pressed.

    And also, I want to modify that code want to do some practical's like blink an LED but i did not know exactly where in that code I have to Change.

    This depends on when you want the LED to blink. If you want it to blink regularly you could create use a timer similar to sFunctionTimer, and then toggle the LED in the callback.

    Best regards,
    Marte

Children
Related