Now we are going to make the robot move. The robot will change direction depending on which button is pressed.
Motors
For the motors there are 3 different variables in the memory. We will use only the first two to start with. motor.side.target is used to specify the speed we want the motors to have. motor.side.speed shows the current speed. Here side is replaced by either 'left' or 'right' to specify which of the two motors is targeted. The following picture shows values which can be viewed from Aseba Studio.
We can see that the actual speed (motor.side.speed) differs slightly from the targeted speed (motor.side.target)
Now we can write code that will activate the motors depending on the buttons.
Now you can try to drive your robot with the buttons (don't forget to Load and Run).
And if you want to disconnect the robot?
Testing the robot with the cable plugged in is not very practical. So what can we do?
If you unplug the robot from your computer, Aseba Studio will try to reconnect, so when you plug the robot back you can continue programming. However, if you close Aseba Studio, your program will be lost. So we suggest that you save the code before disconnecting your robot. To do so, go to the File menu, and click on Save. A dialogue similar to this one will appear:
After that the behaviour is preserved. If anything happens with Aseba Studio while you play with the robot, you can restart Aseba Studio and reload the program file which you just saved.