// This is only for ATmega microcontrollers.
// They have a pin toggle command that uses a single clock cycle.
//
// In Wokwi:
// Right click this text for Command Pallette or press F1.
// then search for 'assembly' en click to View the generate assembly code.
// A new tab was created with "sketch.lst" with the assembly code.
void setup()
{
pinMode(3, OUTPUT);
}
void loop()
{
PIND = bit(PD3); // or (1 << PD3);
__builtin_avr_delay_cycles(99);
PIND = bit(PD3);
__builtin_avr_delay_cycles(999);
PIND = bit(PD3);
}