First you are counting the first serial print as part of the time. You should get millis() right after the calls. As suspected above the espera2() routine is optimized out. See bold comments below
.
void loop()
{
digitalWrite(LED_BUILTIN, LOW); //apaga el LED
6d4: 80 e0 ldi r24, 0x00 ; 0
6d6: 0e 94 87 00 call 0x10e ; 0x10e <digitalWrite.constprop.3>
millis():
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:68
}
unsigned long millis()
{
unsigned long m;
uint8_t oldSREG = SREG;
6da: 2f b7 in r18, 0x3f ; 63
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:72
// disable interrupts while we read timer0_millis or we might get an
// inconsistent value (e.g. in the middle of a write to timer0_millis)
cli();
6dc: f8 94 cli
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:73
m = timer0_millis;
6de: 80 91 59 01 lds r24, 0x0159 ; 0x800159 <timer0_millis>
6e2: 90 91 5a 01 lds r25, 0x015A ; 0x80015a <timer0_millis+0x1>
6e6: a0 91 5b 01 lds r26, 0x015B ; 0x80015b <timer0_millis+0x2>
6ea: b0 91 5c 01 lds r27, 0x015C ; 0x80015c <timer0_millis+0x3>
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:74
SREG = oldSREG;
6ee: 2f bf out 0x3f, r18 ; 63
loop():
/home/dennis/sketchbook/sketch_dec10a/sketch_dec10a.ino:70
tiempo=millis();
6f0: 80 93 5d 01 sts 0x015D, r24 ; 0x80015d
6f4: 90 93 5e 01 sts 0x015E, r25 ; 0x80015e <tiempo+0x1>
6f8: a0 93 5f 01 sts 0x015F, r26 ; 0x80015f <tiempo+0x2>
6fc: b0 93 60 01 sts 0x0160, r27 ; 0x800160 <tiempo+0x3>
700: 60 91 51 01 lds r22, 0x0151 ; 0x800151
704: 70 91 52 01 lds r23, 0x0152 ; 0x800152 <V+0x1>
708: e0 91 4f 01 lds r30, 0x014F ; 0x80014f
70c: f0 91 50 01 lds r31, 0x0150 ; 0x800150 <W+0x1>
710: 80 91 4d 01 lds r24, 0x014D ; 0x80014d
714: 90 91 4e 01 lds r25, 0x014E ; 0x80014e <divisor+0x1>
718: 25 e8 ldi r18, 0x85 ; 133
71a: 33 e0 ldi r19, 0x03 ; 3
71c: 21 50 subi r18, 0x01 ; 1
71e: 31 09 sbc r19, r1
Code generated for espera1
espera1():
/home/dennis/sketchbook/sketch_dec10a/sketch_dec10a.ino:44
for (S=0;S<1;S=S+1)
{
for (T=0;T<1;T=T+1)
{
for (U=0;U<900;U=U+1)
720: 51 f0 breq .+20 ; 0x736 <main+0x198>
722: 49 ee ldi r20, 0xE9 ; 233
724: 53 e0 ldi r21, 0x03 ; 3
726: 68 ee ldi r22, 0xE8 ; 232
728: 73 e0 ldi r23, 0x03 ; 3
72a: 41 50 subi r20, 0x01 ; 1
72c: 51 09 sbc r21, r1
/home/dennis/sketchbook/sketch_dec10a/sketch_dec10a.ino:46
{
for (V=0;V<1000;V=V+1)
72e: b1 f3 breq .-20 ; 0x71c <main+0x17e>
730: e8 ee ldi r30, 0xE8 ; 232
732: f3 e0 ldi r31, 0x03 ; 3
734: fa cf rjmp .-12 ; 0x72a <main+0x18c>
736: f0 93 50 01 sts 0x0150, r31 ; 0x800150 <W+0x1>
73a: e0 93 4f 01 sts 0x014F, r30 ; 0x80014f
73e: 97 51 subi r25, 0x17 ; 23
740: 90 93 4e 01 sts 0x014E, r25 ; 0x80014e <divisor+0x1>
744: 80 93 4d 01 sts 0x014D, r24 ; 0x80014d
748: 70 93 52 01 sts 0x0152, r23 ; 0x800152 <V+0x1>
74c: 60 93 51 01 sts 0x0151, r22 ; 0x800151
750: f0 92 54 01 sts 0x0154, r15 ; 0x800154 <U+0x1>
754: e0 92 53 01 sts 0x0153, r14 ; 0x800153
758: d0 93 56 01 sts 0x0156, r29 ; 0x800156 <T+0x1>
75c: c0 93 55 01 sts 0x0155, r28 ; 0x800155
760: d0 93 58 01 sts 0x0158, r29 ; 0x800158 <S+0x1>
764: c0 93 57 01 sts 0x0157, r28 ; 0x800157
write():
768: 82 e1 ldi r24, 0x12 ; 18
76a: 91 e0 ldi r25, 0x01 ; 1
76c: 0e 94 dc 01 call 0x3b8 ; 0x3b8 <Print::write(char const*) [clone .part.2] [clone .constprop.11]>
millis():
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:68
}
unsigned long millis()
{
unsigned long m;
uint8_t oldSREG = SREG;
770: 2f b7 in r18, 0x3f ; 63
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:72
// disable interrupts while we read timer0_millis or we might get an
// inconsistent value (e.g. in the middle of a write to timer0_millis)
cli();
772: f8 94 cli
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:73
m = timer0_millis;
774: 60 91 59 01 lds r22, 0x0159 ; 0x800159 <timer0_millis>
778: 70 91 5a 01 lds r23, 0x015A ; 0x80015a <timer0_millis+0x1>
77c: 80 91 5b 01 lds r24, 0x015B ; 0x80015b <timer0_millis+0x2>
780: 90 91 5c 01 lds r25, 0x015C ; 0x80015c <timer0_millis+0x3>
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:74
SREG = oldSREG;
784: 2f bf out 0x3f, r18 ; 63
loop():
No code generated for espera2
digitalWrite(LED_BUILTIN, HIGH); //enciende el LED
7ac: 81 e0 ldi r24, 0x01 ; 1
7ae: 0e 94 87 00 call 0x10e ; 0x10e <digitalWrite.constprop.3>
millis():
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:68
}
unsigned long millis()
{
unsigned long m;
uint8_t oldSREG = SREG;
7b2: 2f b7 in r18, 0x3f ; 63
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:72
// disable interrupts while we read timer0_millis or we might get an
// inconsistent value (e.g. in the middle of a write to timer0_millis)
cli();
7b4: f8 94 cli
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:73
m = timer0_millis;
7b6: 80 91 59 01 lds r24, 0x0159 ; 0x800159 <timer0_millis>
7ba: 90 91 5a 01 lds r25, 0x015A ; 0x80015a <timer0_millis+0x1>
7be: a0 91 5b 01 lds r26, 0x015B ; 0x80015b <timer0_millis+0x2>
7c2: b0 91 5c 01 lds r27, 0x015C ; 0x80015c <timer0_millis+0x3>
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:74
SREG = oldSREG;
7c6: 2f bf out 0x3f, r18 ; 63
loop():
/home/dennis/sketchbook/sketch_dec10a/sketch_dec10a.ino:79
tiempo=millis();
7c8: 80 93 5d 01 sts 0x015D, r24 ; 0x80015d <tiempo>
7cc: 90 93 5e 01 sts 0x015E, r25 ; 0x80015e <tiempo+0x1>
7d0: a0 93 5f 01 sts 0x015F, r26 ; 0x80015f <tiempo+0x2>
7d4: b0 93 60 01 sts 0x0160, r27 ; 0x800160 <tiempo+0x3>
write():
7d8: 84 e2 ldi r24, 0x24 ; 36
7da: 91 e0 ldi r25, 0x01 ; 1
7dc: 0e 94 dc 01 call 0x3b8 ; 0x3b8 <Print::write(char const*) [clone .part.2] [clone .constprop.11]>
millis():
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:68
}
unsigned long millis()
{
unsigned long m;
uint8_t oldSREG = SREG;
7e0: 2f b7 in r18, 0x3f ; 63
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:72
// disable interrupts while we read timer0_millis or we might get an
// inconsistent value (e.g. in the middle of a write to timer0_millis)
cli();
7e2: f8 94 cli
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:73
m = timer0_millis;
7e4: 60 91 59 01 lds r22, 0x0159 ; 0x800159 <timer0_millis>
7e8: 70 91 5a 01 lds r23, 0x015A ; 0x80015a <timer0_millis+0x1>
7ec: 80 91 5b 01 lds r24, 0x015B ; 0x80015b <timer0_millis+0x2>
7f0: 90 91 5c 01 lds r25, 0x015C ; 0x80015c <timer0_millis+0x3>
/home/dennis/arduino-1.8.13/hardware/arduino/avr/cores/arduino/wiring.c:74
SREG = oldSREG;
7f4: 2f bf out 0x3f, r18 ; 63
loop():