1 Microsecond pulses

This gives about 1.2us pulses, and disables interrupts during the pulse output to stop them occasionally stretching.

Disabling interrupts also means that any calls to digitalWrite () for pins in the D port in interrupt routines aren't broken by our direct port manipulation.

void setup ()
{
  pinMode (4, OUTPUT) ;
  digitalWrite (4, LOW) ;  // or set to HIGH for low-going pulses.
}

void loop ()
{
  pulse () ;
  delayMicroseconds (5) ;
}

void pulse ()
{
  cli () ;
  PIND = 0x10 ;
  __asm__("nop\n\t");
  __asm__("nop\n\t");
  __asm__("nop\n\t");
  __asm__("nop\n\t");
  delayMicroseconds (1) ;
  PIND = 0x10 ;
  sei () ;
}