- mdehaas
- Messages : 2
Date d'inscription : 2021-03-05
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.
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.
- mdehaas
- Messages : 2
Date d'inscription : 2021-03-05
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 :-)
Permissions in this forum:
You cannot reply to topics in this forum