def squ_wave(outputdev, freq, sec):
assert isinstance(outputdev, OutputDevice)
switch_freq = tick_half(freq)
tm = timer(sec)
tm.start()
while not tm.arrival():
sleep(switch_freq)
outputdev.toggle()
outputdev.value = False
评论列表
文章目录