My sketch:
#include <Arduino.h>
typedef struct CONTROL_T
{
__ char controlName;__
** uint8_t msgParam1;*
** uint8_t msgParam2;**
** uint8_t msgParam3;**
}control_t;
const PROGMEM control_t controls[8] =
{
** { "Bob", 0,0,0 }, // 0**
** { "Tom", 0,0,0 }, // 1**
** { "Dick", 0,0,0 }, // 2**
** { "Harry",0,0,0 }, // 3**
** { "Steve",0,0,0 }, // 4**
** { "Phil", 0,0,0 }, // 5**
** { "Dom", 0,0,0 }, // 6**
** { "Mark", 0,0,0 } // 7**
};
void setup()
{
** int cnt;**
** Serial.begin( 57600 );**
** Serial.print( 0 );**
** Serial.print( ": " );**
** Serial.println( controls[0].controlName );**
** Serial.print( 1 );**
** Serial.print( ": " );**
** Serial.println( controls[1].controlName );**
** Serial.print( 2 );**
** Serial.print( ": " );**
** Serial.println( controls[2].controlName );**
** for( cnt=0 ; cnt<3 ; cnt++ )**
** {**
** Serial.print( cnt );**
** Serial.print( ": " );**
** Serial.println( controls[cnt].controlName );**
** }**
}
void loop()
{
}
The output is:
13:00:43.995 -> 0: Bob
13:00:43.995 -> 1: Tom
13:00:43.995 -> 2: Dick
13:00:43.995 -> 0:
13:00:43.995 -> 1:
13:00:43.995 -> 2:
Why does indexing the array of structures work with literal values but not the integer variable cnt ???
TIA