Remote control
The following code allows to control the robot with a standard RC5 remote control:
onevent rc5
if rc5.command == 2 then
motor.left.target = 300
motor.right.target = 300
elseif rc5.command == 8 then
motor.left.target = -300
motor.right.target = -300
elseif rc5.command == 4 then
motor.left.target = -300
motor.right.target = 300
elseif rc5.command == 6 then
motor.left.target = 300
motor.right.target = -300
else
motor.left.target = 0
motor.right.target = 0
end