Arduino Mega Cable Tester

So here is my arduino mega cable tester that I built for testing 26 pin ribbon cable. It uses a Arduino Mega, the program is very simple it just the blink code duplicated to run pin by pin through all 26 pins of the cable.  I am hoping that this test fixture will allow us to test cables that we build so that we have a higher confidence in them not being bad when we install them into our products.

Code

 /*
  Cable Tester
  Turns on an LED to check if there are any shorts or bad connections
  in the cable
 */

// Defining all the output
int led0 = 22;
int led1 = 23;
int led2 = 24;
int led3 = 25;
int led4 = 26;
int led5 = 27;
int led6 = 28;
int led7 = 29;
int led8 = 30;
int led9 = 31;
int led10 = 32;
int led11 = 33;
int led12 = 34;
int led13 = 35;
int led14 = 36;
int led15 = 37;
int led16 = 38;
int led17 = 39;
int led18 = 40;
int led19 = 41;
int led20 = 42;
int led21 = 43;
int led22 = 44;
int led23 = 45;
int led24 = 46;
int led25 = 47;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led0, OUTPUT);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT); 
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);  
  pinMode(led6, OUTPUT);
  pinMode(led7, OUTPUT);
  pinMode(led8, OUTPUT); 
  pinMode(led9, OUTPUT);
  pinMode(led10, OUTPUT);
  pinMode(led11, OUTPUT); 
  pinMode(led12, OUTPUT);
  pinMode(led13, OUTPUT);
  pinMode(led14, OUTPUT); 
  pinMode(led15, OUTPUT); 
  pinMode(led16, OUTPUT);
  pinMode(led17, OUTPUT);
  pinMode(led18, OUTPUT); 
  pinMode(led19, OUTPUT);
  pinMode(led20, OUTPUT);
  pinMode(led21, OUTPUT);  
  pinMode(led22, OUTPUT);
  pinMode(led23, OUTPUT);
  pinMode(led24, OUTPUT); 
  pinMode(led25, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led0, HIGH);   
  delay(100);               
  digitalWrite(led0, LOW);    
  delay(100);               
  digitalWrite(led1, HIGH);   
  delay(100);               
  digitalWrite(led1, LOW);    
  delay(100);               
  digitalWrite(led2, HIGH);  
  delay(100);               
  digitalWrite(led2, LOW);    
  delay(100);              
  digitalWrite(led3, HIGH);   
  delay(100);              
  digitalWrite(led3, LOW);   
  delay(100);              
  digitalWrite(led4, HIGH);  
  delay(100);              
  digitalWrite(led4, LOW);    
  delay(100);               
  digitalWrite(led5, HIGH);   
  delay(100);               
  digitalWrite(led5, LOW);   
  delay(100);               
  digitalWrite(led6, HIGH);  
  delay(100);              
  digitalWrite(led6, LOW);    
  delay(100);               
  digitalWrite(led7, HIGH);   
  delay(100);               
  digitalWrite(led7, LOW);   
  delay(100);               
  digitalWrite(led8, HIGH);   
  delay(100);               
  digitalWrite(led8, LOW);    
  delay(100);              
  digitalWrite(led9, HIGH);   
  delay(100);               
  digitalWrite(led9, LOW);    
  delay(100);               
  digitalWrite(led10, HIGH);   
  delay(100);              
  digitalWrite(led10, LOW);    
  delay(100);               
  digitalWrite(led11, HIGH);   
  delay(100);              
  digitalWrite(led11, LOW);    
  delay(100);    
  digitalWrite(led12, HIGH);   
  delay(100);               
  digitalWrite(led12, LOW);    
  delay(100);               
  digitalWrite(led13, HIGH);   
  delay(100);               
  digitalWrite(led13, LOW);    
  delay(100);               
  digitalWrite(led14, HIGH);  
  delay(100);               
  digitalWrite(led14, LOW);    
  delay(100);              
  digitalWrite(led15, HIGH);   
  delay(100);              
  digitalWrite(led15, LOW);   
  delay(100);              
  digitalWrite(led16, HIGH);  
  delay(100);              
  digitalWrite(led16, LOW);    
  delay(100);               
  digitalWrite(led17, HIGH);   
  delay(100);               
  digitalWrite(led17, LOW);   
  delay(100);               
  digitalWrite(led18, HIGH);  
  delay(100);              
  digitalWrite(led18, LOW);    
  delay(100);               
  digitalWrite(led19, HIGH);   
  delay(100);               
  digitalWrite(led19, LOW);   
  delay(100);               
  digitalWrite(led20, HIGH);   
  delay(100);               
  digitalWrite(led20, LOW);    
  delay(100);              
  digitalWrite(led21, HIGH);   
  delay(100);               
  digitalWrite(led21, LOW);    
  delay(100);               
  digitalWrite(led22, HIGH);   
  delay(100);              
  digitalWrite(led22, LOW);    
  delay(100);               
  digitalWrite(led23, HIGH);   
  delay(100);              
  digitalWrite(led23, LOW);    
  delay(100);    
  digitalWrite(led24, HIGH);   
  delay(100);               
  digitalWrite(led24, LOW);    
  delay(100);               
  digitalWrite(led25, HIGH);   
  delay(100);              
  digitalWrite(led25, LOW); 
}
int timer = 10;           // The higher the number, the slower the timing.
int time=1;
int ledPins[] = { 
  22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 
  35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47 };       // an array of pin numbers to which LEDs are attached
int pinCount = 26;           // the number of pins (i.e. the length of the array)

void setup() {
  // the array elements are numbered from 0 to (pinCount - 1).
  // use a for loop to initialize each pin as an output:
  for (int thisPin = 0; thisPin < pinCount; thisPin++)  {
    pinMode(ledPins[thisPin], OUTPUT);      
  }
}

void loop() {
  // loop from the lowest pin to the highest:
  for (int thisPin = 0; thisPin < pinCount; thisPin++) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);   
    delay(timer);                  
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);
    delay(timer + time)  ;

  }

  // loop from the highest pin to the lowest:
  for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);
    delay(timer);
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);
    delay(timer + time);
  }
}

Bottom of VeroBoard

Ribbon Cable attached to the test fixture.
Ribbon Cable attached to the test fixture.
The Arduino and test fixture together.
The Arduino and test fixture together.