Add flash method to output devices and boards, close #22

This commit is contained in:
Ben Nuttall
2015-09-23 15:31:06 +01:00
parent 931571b85d
commit b97e97909c
2 changed files with 34 additions and 0 deletions

View File

@@ -64,6 +64,14 @@ class DigitalOutputDevice(OutputDevice):
else:
self.on()
def flash(self, on_time=1, off_time=1, n=1):
for i in range(n):
self.on()
sleep(on_time)
self.off()
if i+1 < n: # don't sleep on final iteration
sleep(off_time)
class LED(DigitalOutputDevice):
pass