implement a simple program to test structure initialisation, e.g. using a NodeMCU ESP8266
struct Perintah
{
char type[5];
char command[8];
int VPIN_BUTTON_1[8];
int VPIN_BUTTON_2[8];
int VPIN_BUTTON_3[8];
} perintah = {"", "",{0},{0},{0}};
struct Perintah command = {" "};
struct Perintah test = {"tst1","test2",{1,2,3},{7,8,9},{10,1,12}};
void setup() {
Serial.begin(115200);
Serial.println(test.command);
Serial.println(test.VPIN_BUTTON_1[0]);
Serial.println(test.VPIN_BUTTON_2[2]);
Serial.println(test.VPIN_BUTTON_2[6]);
}
void loop() {
Serial.println(test.VPIN_BUTTON_3[2]++);
delay(2000);
}
serial monitor displays
test2
test2
1
9
0
12
13
14
15