// using a step function to generate a square wave Step step => dac; // half of duty cycle 10 => float T; // infinite loop while( true ) { // high 1 => step.next; // wait T::ms => now; // low -1 => step.next; // wait T::ms => now; }