Here are some sample programs that combine the use of the motors and the sensors into more involved programs.
This program keeps the robot inside a white surface. The surface is white and has a blue border all around it. Once the robot hits the blue lines, it stops, turns around and moves again until it hits a blue line again.
Follow a dark line
This program works with the color sensor, and follows a dark line on a white surface.