Created
January 2, 2016 01:44
-
-
Save Tiny-Giant/2da98f24a8eb6781d740 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import readchar | |
import sys | |
fw = open("pipe1", "w" ) | |
while True: | |
key = readchar.readkey() | |
key = key.lower() | |
if key == 'w': | |
fw = open("pipe1", "w" ) | |
fw.write('fd\n') | |
fw.close() | |
print "w - fd" | |
elif key == 'a': | |
fw = open("pipe1", "w" ) | |
fw.write('turn_lt\n') | |
fw.close() | |
print "a - turn_lt" | |
elif key == 's': | |
fw = open("pipe1", "w" ) | |
fw.write('bk\n') | |
fw.close() | |
print "s - bk" | |
elif key == 'd': | |
fw = open("pipe1", "w" ) | |
fw.write('turn_rt\n') | |
fw.close() | |
print "d - turn_rt" | |
elif key == 'q': | |
fw = open("pipe1", "w" ) | |
fw.write('lt\n') | |
fw.close() | |
print "q - lt" | |
elif key == 'e': | |
fw = open("pipe1", "w" ) | |
fw.write('rt\n') | |
fw.close() | |
print "e - rt" | |
elif key == 'p': | |
fw = open("pipe1", "w" ) | |
fw.write('stop\n') | |
fw.close() | |
print "stop" | |
sleep_time = 0.030 | |
if key == '.': | |
print "finished" | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment