Good day,
I wrote this simple code, ATMEGA8A microcontoller
void setup() {
pinMode(1, OUTPUT);
for (byte i = 0; i < 2; i++) {
digitalWrite(1, HIGH);
delay(1000);
digitalWrite(1, LOW);
delay(1000);
}
}
void loop() {
// put your main code here, to run repeatedly:
}
which is executing the loop 2 times,
when compiled it used 888 bytes of storage space.
but when I edited the loop line to 3 times:
for (byte i = 0; i < 3; i++) {
and when compiled it used 868 bytes of storage space.
it used less space, why smaller loop using larger space ?
I think they must use same space or larger space for larger loop.
I'm asking that because I have a large project that occupies all microcontroller space almost, and when I decrease the loop count the program get bigger and doesn't fit the microcontroller.
thank you
9 posts - 3 participants