bicycleguy
Well-known member
Using Arduino IDE 2.3.3 on MacOS 14.6.1 Sonoma, Teensy Loader 1.59
The code below:
produces:
If the commented line is moved before the line above it I get the proper results:
what up ?
The code below:
Code:
int gdefaultState=7;
void setup() {
Serial.begin(115200);
while(!Serial);
;
Serial.printf("in setup gdefaultState=%d \n", gdefaultState);
}
void loop() {
static boolean finished=false;
static uint32_t lastime=millis();
static int state=gdefaultState; //why can't this line follow the millis() line?
if(!finished){
Serial.printf("state=%d, gdefaultState=%d \n", state, gdefaultState);
finished=true;
}
}
produces:
Code:
in setup gdefaultState=7
state=0, gdefaultState=7
Code:
in setup gdefaultState=7
state=7, gdefaultState=7
Last edited: