My first real RC truck project LED Arduino

Its confusing because I left out a key piece of code in that post.

The sequenceLEDS routine should have added the firstPin value to the digital writes:

void sequenceLEDS( int *sequence , int length, int repeats)
{
  for( int counter=0; counter < repeats; counter++)
  {
    for( int i = 0; i < length; i++)
    {
      digitalWrite(sequence[i]+ firstPin ,HIGH);
      delay(100);  
    }
    for( int i = 0; i < length; i++)
    {
      digitalWrite(sequence[i]+ firstPin,LOW);
      delay(100);  
    }
  }    
}

This is still untested, but for example, with
int leftSequence[] = { 2,1,0};
this should do the following:

  • digital write to firstPin + 2 (pin 4)
  • digital write to firstPin + 1 (pin 3)
  • digital write to firstPin + 0 (pin 2)

I hope that helps