We study some mechanical problems in which a friction force is acting on a system. Using the fundamental concepts of state, time evolution and energy conservation, we explain how to extend Newtonian mechanics to thermodynamics. We arrive at the two laws of thermodynamics and then apply them to investigate the time evolution and heat transfer of some significant examples.