Serial monitor / arduino trips out...

So, we have to make a robot car that can move a human. It needs to carry 80 kilo's, so we have quite big motors. It controls itself by following a line. I only have the following problem...

I made the code in two parts, first the part of the polulu qtr-8rc, That callibrated and read the line perfectly, then i made the part that controls the motors, also that worked perfectly. Now i put the two together, and my serial monitor flips out. It only reads maximum value's while calibrating, and then only displays zero's. Sometimes a string of weird characters appear also. The motors stop turning and start tweaking in all directions. Then it just stops until i reset the arduino again.

I used two very high current motors. (out of two cheap drills) They pull about 18 ampere's together when starting up, and around 15 when on a steady speed. We power the motors with two 12V battery's connected in parallel. (for high amp pulling capabilities.) They did work on these batteries before I put the program together. Im using a motorshield with 8 amp continous and 15 amp max.

Program included.

Hope someone can help me out! Its for my exams. (If you dont understand a part please notify me, i'm dutch, so some of the program is too.)

Programma_arduino_1_compleet.ino (5.22 KB)

By the way, here is a piece of the serial monitor:

2500 2500 2500 2500 2500 2500 2500 2500
2500 2500 2500 2500 2500 2500 2500 2500

0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 00 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 00 0 0 0
0 0 0 0 00 0 00
0 0 0 0 0 0 0 0 0
00 0 0 0
0 00 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 00 0 0 0 0 0
0 0 00 0 0 0 0
0 0 00 0 0 0 0
0 0 00 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 / 0 0 0 00
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 00 0 0 00
0 0 00 0 0
00 0 0 0 0
0 0 0 0 0 0 0 0
0 0 00 0 0 0 0 0
0 0 00 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0
00 0 0 0
0 0 00 0 0 0 0 0
0 0 0 0 0 0 0 0
00 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 00 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 00
0 0 0 0 0 0 0 0 0
00 0 0 0 0 0 00
0 0 0 0 0 0 0 0
00 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 00 0 0 0 0 0
0 0 0 0 00 0 0
0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 00 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 10/|t«å×ZÊó}q—÷¯í[ò¹}åÃÿŽlúR¾]ò=ÙÚÕBiÕòëM÷¾óvïGÿ·¶Ÿ>÷
»ï×ø›Ç8mßïÏ;åc»ÿãkïgÿ§Aú:ºÿ†üý&©šbúWÛÛdÞåÏëwæåþõÔé‘]-Ð÷¯·ÿ_Ûo^¿+ÿJù~çkxÓwžÞ<Ÿ§Ö~zRí·WñפµŸ–¶ÿ$ùŸžµÿ_9Ìþ·õýÃÆÔî¾Ë­?ëîÝüÝqa+qúzšÁL¿Í[÷ý¸wäý1ÓŸ»7ÝuÁçý÷»ïzíïí~ê
ï&õûZžóû™�Œ /÷�ÎeV×K?�ÿ{wûÛ%ìç×ïý—Þ¤]oW¾»U¯þéí>0kßQõ­³˜ì3õIüþŸ·ý>»¼ÍõÞ¡L×lûÜôoÿŸÿ¿ëþþc/é·ïÛÿ‹zw{Ú6RÞú×¾¤÷Ï{æwð[ÍùîI¯}÷»Ùïþªeý÷èì³ýåÞ~’–ÏeüöäO,{æžÿ¹þ§¨}…ñz¶1óxÓΕ¾Hž•‹Ìo…y&ïpeþã;
<ûÞßÛ�}Ùw±ÿí¯Úݺ'ôiØ®ÒÙoïúþÏnó¿§zf�¾vw®ýõ÷ÿÿ²z÷þÕvqúÃiÿn8ö/�½ÇÔøÛ®^Ú¾8¶ÃØo»÷ìœ[ùZ8Îû¹Èéûuý
}ä»ÂÙÿËwò²Ýfy÷eéßö�úÝ‹ÿy]Ïõ?Ÿ°¦êÞëÛËåwÆËf}à¿ûoçßJ­Þ›©5]¬û›=j´O®ý}7ÒwF~øÖñ?ßßôÏúÏóØýòzÅçþ{ïö²«ÕSßó«êW'm‹[==“3ÿú>Ÿ…ß ñû›ó‘Þ/Ö�å»z9wC}®ÿüá×/—¿¿g•ºV·WýÞ»ý÷võÒúÿönãHÿ¨»J¾Ÿþþ¶`f÷øï?ÔS‘;³á»¾¼_Õ߷cÿ—»l¾mýù}ü^ñ¯-×ï[ìx�o�û�®od'ï^Óøûuñê—XWí¶Ío,Õsoç]«ý\÷Eî!ß�;–tÿÉÞN•ûO¿=âŸ>Y÷2xÜiïKyßï¹³ è>ëÍ3¾ßí7·Æ¿Ï®~§«-Zê󦾶�¿ßþçÛù ýû;™Wö%¤»nüã·E¯ù~«¿Éÿe�ãëχ~µ|Ë>þü¿Nñ™{Þö¥¼ý}bGïÚ¬õÞ÷ýGÔcjoô-¬ýo¾—2ýÍoYoËóñüÛ¿Ëÿk×ZN*�ÔúoûƒS¶ûþù~ížÝßÁܬ›�¿×1ìŽ÷V^]ð|ûÿ|H''0
0 00 0 00 0

  if (position >0 <1000)

You can't do that.

  if (position > 0 && position < 1000)

@MarkT Thank you! It works for some part. It does switch between state's but as soon as i connect both motors, it flips out. Without the motors it works fine. The program switches perfectly between states, but as soon as the motor are connected it flips out.