miranda
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
mdehaas
Messages : 2
Date d'inscription : 2021-03-05

Use of strings in python code Empty Use of strings in python code

Fri 5 Mar - 9:50
I don't understand why the robot does not move when I add a string variable. For example:

import thymio

var1 ="B"
thymio.leftwheel.setpower(100)
thymio.rightwheel.setpower(100)
while True:
if var1 == "B":
thymio.leftwheel.setpower(100)
thymio.rightwheel.setpower(0)
else:
thymio.leftwheel.setpower(0)
thymio.rightwheel.setpower(100)

The robot does not drive at all when using this code.
avatar
mdehaas
Messages : 2
Date d'inscription : 2021-03-05

Use of strings in python code Empty Re: Use of strings in python code

Fri 5 Mar - 9:51
Ah the indentation is removed when posted the reply, so assume that the identation was correct :-)
Back to top
Permissions in this forum:
You cannot reply to topics in this forum