@@ -42,16 +42,11 @@ const uint8_t MAX_LIGHT_NUMBER = 6;
4242MatterOnOffLight OnOffLight[MAX_LIGHT_NUMBER];
4343
4444// all pins, one for each on-off light
45- uint8_t lightPins[MAX_LIGHT_NUMBER] = { 2 , 4 , 6 , 8 , 10 , 12 }; // must replace it by the real pin for the target SoC and application
45+ uint8_t lightPins[MAX_LIGHT_NUMBER] = {2 , 4 , 6 , 8 , 10 , 12 }; // must replace it by the real pin for the target SoC and application
4646
4747// friendly OnOffLights names used for printing a message in the callback
4848const char *lightName[MAX_LIGHT_NUMBER] = {
49- " Room 1" ,
50- " Room 2" ,
51- " Room 3" ,
52- " Room 4" ,
53- " Room 5" ,
54- " Room 6" ,
49+ " Room 1" , " Room 2" , " Room 3" , " Room 4" , " Room 5" , " Room 6" ,
5550};
5651
5752// simple setup() function
@@ -75,15 +70,16 @@ void setup() {
7570
7671 // setup all the OnOff Light endpoint and their lambda callback functions
7772 for (uint8_t i = 0 ; i < MAX_LIGHT_NUMBER; i++) {
78- pinMode ( lightPins[i], OUTPUT); // set the GPIO function
79- OnOffLight[i].begin (false ); // off
73+ pinMode (lightPins[i], OUTPUT); // set the GPIO function
74+ OnOffLight[i].begin (false ); // off
8075
8176 // inline lambda function using capture array index -> it will just print a message in the console
8277 OnOffLight[i].onChangeOnOff ([i](bool state) -> bool {
8378 // Display message with the specific light name and details
84- Serial.printf (" Matter App Control: '%s' (OnOffLight[%d], Endpoint %d, GPIO %d) changed to: %s\r\n " ,
85- lightName[i], i, OnOffLight[i].getEndPointId (),
86- lightPins[i], state ? " ON" : " OFF" );
79+ Serial.printf (
80+ " Matter App Control: '%s' (OnOffLight[%d], Endpoint %d, GPIO %d) changed to: %s\r\n " , lightName[i], i, OnOffLight[i].getEndPointId (), lightPins[i],
81+ state ? " ON" : " OFF"
82+ );
8783
8884 return true ;
8985 });
@@ -110,7 +106,7 @@ void loop() {
110106 }
111107 }
112108 Serial.println (" Matter Node is commissioned and connected to the WiFi network. Ready for use." );
113- }
114-
115- delay (500 );
109+ }
110+
111+ delay (500 );
116112}
0 commit comments