I am trying to control a ball grabber robot using NXT 1. My goal is to have the robot facing the same direction before searching for the second ball. The program I am testing with almost gets the robot back to the starting position, but not quite. The reason I am doing this is to take the balls to a drop off location. The code attached is just to test with, not the full program. It does not grab any balls.
Yes, this is the correct forum for NXT questions, although you may want to consider posting here as well (http://messageboards.lego.com/en-US/showforum.aspx?ForumID=1042.) Thank you for providing screenshots of your code, but it is a little difficult to determine what it does without notation; would you be able to provide the program for us look at directly? It would also help a lot if you could describe how you are getting the robot to move and return to the same position (e.g. motor on timing, motor position, sensor-determined location, etc.) as well as what you mean by "almost gets the robot back"- what sort of positional shift are you seeing?
There are a lot of resources online and in the software that can help with example code for the different sensors.
This website offers a lot of valuable information regarding the programming. It also has examples in the different programming languages you can use.
They also have Quick Guides to Programming that show very simple code and explanations. There is a basic example written in the guide specific to the light sensor.
There are also examples for different builds and programming guides in the ROBO Center on the right of the screen when you open the NXT Mindstorm software.