Line follower robot

(deleted)

linefollowerc.ino (6.81 KB)

Code tags required.

And turn your caps lock off.

I believe this

  /* Set-up IR sensor pins as input */

  for (int i = 0; i <= 5; ++i)
  {
    pinMode(irPins, INPUT);
  }

should be this

  /* Set-up IR sensor pins as input */

  for (int i = 0; i <= 5; ++i)
  {
    pinMode(irPins[i], INPUT);
  }

Bhupeshious:
I AM MAKING A LINE FOLLOWER BOT GUYS,THE ROBOT IS WORKING OKAY.BUT I WANT TO IMPROVE THE
CODE BY USING WHILE LOOP IN CERTAIN CONDITIONS BUT WHILE USING WHILE LOOP IT RUNS AS INFINITE LOOP.

This doesn't make sense to me. Please be specific about "IN CERTAIN CONDITIONS" and "WHILE USING WHILE LOOP IT RUNS AS INFINITE LOOP".

And turn off the Caps Lock please.

You have a working program. So what makes you think that adding a while loop to it would improve it? In what way would it be improved?

Steve

To put your code in a code box, use the </> icon in the far left of the post tool bar and paste your code between the two bracket sets that appear.

To go back and put your code in a code box, in the bottom right of your post, select “more” and click modify. When the modify post opens, high light your code and click the </> in the far left of the post tool bar. This will put you code in code brackets. Then save the changes.