Square pulse generator using internal register.

The same history with tone(), pulse width and frequency tremor.

Code:

void setup()
{

pinMode(5,OUTPUT);
}

void loop() { // put your main code here, to run repeatedly:
tone(5,20000);

}

To wach oscilloscope test on youtube: