If you make the built-in LED to blink 5 times, it will blink 3 instead, then blink the external LED, followed by another 2 blinks on the built-in LED.
If you make the built-in LED to blink 6 times, it will blink 3 instead, then blink the external LED, followed by another 3 blinks on the built-in LED.
The console shows the right sequence.
Teensy 3.2 and 3.6 show the same symptom.
Something interrupts digitalWriteFast().
If you make the built-in LED to blink 6 times, it will blink 3 instead, then blink the external LED, followed by another 3 blinks on the built-in LED.
The console shows the right sequence.
Teensy 3.2 and 3.6 show the same symptom.
Something interrupts digitalWriteFast().
Code:
void toggle(uint8_t pin, uint32_t count) {
// volatile uint32_t index;
for (; count; --count) {
digitalWriteFast(pin, !digitalRead(pin));
Serial.print("+");
// for (index = 0; index < 80000; ++index) {}
delay(500);
}
Serial.println();
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
pinMode(0, OUTPUT);
}
void loop() {
toggle(LED_BUILTIN, 5);
toggle(0, 1);
}
Last edited: