I can't find the Problem in My Code

I made a code that uses the TinyGPS library to make a remote control car drive to a certain coordinate point. I am pretty new to coding, so I can't get this to work right. The problem is that the car won't turn. I know this is a software issue, not hardware; I have tested the turning motor. Will someone please help me fix the turning code? You can see my code here: http://pastebin.com/m3cddfb63. I highlighted the turning sections, sorry if it is too unorganized. Thanks in advance, this has been frustrating me for days, I have redesigned the turning systems over and over. I was thinking it may have to do with TinyGPS's course method, maybe I should make my own. I would make it save the previous coordinates and get the course from that to the current ones, but how would I make that code? Again, thank you so much for helping me.

Well I'm not really qualified enough to comment on your code, however something I read recently might be Germaine. It seems that Sparkfun ( http://www.sparkfun.com/commerce/news.php?id=259 ) recently hosted a autonomous vehicle event and the goal was to be able to circle their building. Some contestants commented that GPS didn't work well in turning corners and really required the use of a electronic compass to assist in making turns. So maybe it's not your code so much as a misapplication of GPS?

Good luck


I think the highlighted section is nested in the else clause just above it. The preceding else has an opening { and if (forward == false) has an opening { but only the else has a closing }. Your indentation makes it look like you forgot a closing }

{ ← opens the else
digitalWrite(dirapin, 1);
forward = false;
if (forward == false)
{ ← opens the if
digitalWrite(dirapin, 0);
forward = true;
} ← closes the if

Ray: Thanks! I don't know how I didn't notice. Having it like that makes it only turn when it is at the waypoint. Thanks for looking, I'll test the new code now!