#!/usr/bin/python2.7
import sys
from time import sleep
def modem(text, speed):
# Assume speed is in bits/sec, and we're running at 8,N,1
# So, 10 bits per character. (1 start, 8 char, 1 stop)
delay = 1.0 / (speed / 10) # = seconds per character
for char in text:
sys.stdout.write(char)
sys.stdout.flush()
sleep(delay)
if __name__ == "__main__":
if len(sys.argv) > 1:
baud = int(sys.argv[1])
else:
baud = 300
for ln in sys.stdin:
modem(ln, baud)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.