square wave, test not fully working