You've probably searched the forum already, but there is some very informative mapping/pathfinding threads on this forum. I actually started one awhile back discussing the A* algorithm for mapping. A sample C++ code was even posted in that thread. Here's the link:http://www.societyofrobots.com/robotforum/index.php?topic=5342.0
Unfortunately, this pathfinding program finds a path from a preexisting map, stored as a matrix (kind of like a XY grid). It does not create its own map from sensor data. If you could find a way to create an XY grid from sensory data, then this code could be used. This is only 1 possible way to do this; there are many ways of approaching this task.
I would recommend you research the "Monte-Carlo/Markov localization" technique. This, theoretically, can work using several IR or ultrasonic sensors. Computer vision is also a possibility, but this may be difficult to implement on a microcontroller-based robot.
Hopefully, this helped give you some ideas to think about.