0

When I use i=input nothing happens (no error, the robot just won't read the pressed 1 and go to the first loop). My guess is that input only waits for the user to press enter. Is there an equivalent for the user to press a specific number, to activate the if-loops below?

i=...?

if(i==1)
    current_pose = dType.GetPose(api)
    dType.SetPTPCmdEx(api, 2, x1,  y1,  z1, current_pose[3], 1)
    i=i+1

if(i==2)
    current_pose = dType.GetPose(api)
    dType.SetPTPCmdEx(api, 2, x2,  y2,  z2, current_pose[3], 1)
    i=i-1
Lerple
  • 1
  • 1
    [`input`](https://docs.python.org/3/library/functions.html#input) is a function: you need to call it: `input()`. (was that your question?) and note that it will return `str`ings. you may have to convert them to `int`egers. – hiro protagonist Jan 29 '20 at 08:47
  • Sorry, I did use i=input(). I forgot to add them in the text here – Lerple Jan 29 '20 at 08:49
  • then you are missing something like `i = int(i)`. this may help: https://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response – hiro protagonist Jan 29 '20 at 08:51

0 Answers0