LEGO NXT inclination control

You can control the robot easily with the inclination of your device. The following instruction shows you how to program it.
Plug the engines as follows: A: Engine for the arm of the robot / B: Engine for the right wheel. / C: Engine for the left wheel.



1) You constantly have to control the inclination of the device with a forever loop. Depending on the inclination the matching motors are driven. On possible way is to make for each direction one object.

2) On the right side you see the bricks that are used in one of thes objects. Within the inclination is checked constantly. If the inclination is clearly, respectively the inclination value is large or small enough the motor is driven. Each object consists of an forever loop. Within this loop the inclination is checked with an if brick. Depending on which object, the corresponding motor is driven.

3) One special case is if the phone has no clear inclination. The additional object "no inclination controller" checks if the device has no clear orientation and stops all motors. For this case a you have to define a range, where the robot stops. The other bricks in this object are similar to the other objects.