OPTIONAL output protection circuitry
This circuitry can be completely omitted, but if used it should protect the Arduino against accidentally connecting the outputs to voltages of up to at least plus and minus 30V without significantly increasing square wave rise and fall times. The diodes need to be high current types. D2 and D3 (for the square wave only) also need to be fast recovery diodes if using at very high frequencies - I found that schottky diodes were a bit slow. The fuses (F1 and F2) can be polyfuses.
If only using the analogue output for connection to an amplifier (e.g. for music) only ZD1 and R1 are needed for static protection (before the coupling capacitor). ZD1 can then be a low current type and a considerably higher voltage if necessary but not lower, and make R1 a much higher value (approx. 1 – 5k). Only two non-critical components needed, so don’t risk destroying your Arduino! (Note: A second similar resistor, in series with the coupling capacitor, would protect ZD1 if it’s a low current type.)