I am trying to use my keyboard to control motors using L298N Dual Hbridge PWM. I have written the code for taking input from keyboard as:
def getch():
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch
This is just a portion of my code .After running the module I get error as:
char = getch()
fd = sys.stdin.fileno()
UnsuppoertedOperation : fileno()
Please help me out . Is there any need for me to download some module to support getch() ?