I stay motivated by knowing that I will run into issues. When I do, I give it a solid attempt, but after a certain amount of time I either take a break or work on something else.
You will always hit issues, when you do, what you do and the frame of mind at which you perceive the issue is what will continue to motivate you.