In the past few months I've been working on a renewed RobotC program for a LEGO MINDSTORMS NXT Segway.
The current program handles all balancing tasks in the background so you can make the Segway do what you want without worrying about balancing. It supports both the HiTechnic Gyro sensor and the new Dexter Industries dIMU. The complete source and instructions are available on my website.
The older ready to run NXT-G version of the program (only supports HiTechnic Gyro) is also still available.
Many of you have been asking for the source code, so here's a chance to study the balancing algorithm. You may use and edit the code as you like, but don't forget to link to the original code and give credit if you reshare your program.
Update: Just another example of what you could use the code for!