First, Here is the code that I would like to include in the robot code:
Code:
// KITT LIGHT
int ledPins[]={2,3,4,5,6,7,8,9,10};
void setup()
{
// initialize the digital pins (D2-D10) as output.
for(int i =0; i<9; i++)
{
pinMode(ledPins*, OUTPUT);*
- }*
}
void loop()
{ - int i = 0;*
- while (i<9)*
- {*
- {*
_ digitalWrite(ledPins*, HIGH); // Turn the LED on._
_ delay(120); // Wait for 100 milliseconds._
_ digitalWrite(ledPins, LOW); // Turn the LED off.
i++;
}
}
i=7;
while(i>0)
{
digitalWrite(ledPins, HIGH);
delay(120);
digitalWrite(ledPins, LOW);
i--;
}
}
/Code*
I know I cannot use delay as it will, I believe stop all robot functions. I could probably add another battery supply and another Arduino Uno, upload and just run it off the digital ports I already have. But, I would like to learn how to make this code better.
I can provide the osoyoo code also which is the Obstacle code.
Thanks,
Leo_