Import Robot and curses Programm.Please help meeee | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Import Robot and curses Programm.Please help meeee

Hello everbody could anybody this Python Code to me. I am a beginner and preapring for a Test. I really do not understand this code. Please could anybody explain it in deatail, if possible also step by step (only I possible) import curses from gpiozero import Robot robot = Robot(left=(21, 26), right=(22,17) actions = { curses.KEY_UP: robot.forward, curses.KEY_DOWN: robot.backward, curses.KEY_LEFT: robot.left, curses.Key_RIGHT: robot.right, } def main(window): next_key = None while True: curses.halfdelay(1) if next_key is None: else:key = window.getch() key = next_key next_key = None if key != -1: curses.halfdelay(3) action = actions.get(key) if action is not None: action() next_key = key while next_key == key: next_key = window.getch() robot.stop() curses.wrapper(main)

4th Oct 2019, 6:13 PM
N Sivaram
N Sivaram - avatar
1 Answer
0
xxxxxxcccxxccxxxx,,, , Brazzer
14th Feb 2020, 10:24 AM
Shubhu Guleria
Shubhu Guleria - avatar