Arduino MEGA Debugging LEDs

Kibitzing on a project involving an Arduino Mega (properly MEGA, but who cares?) with plenty of spare I/O pins led me to slap together a block of LEDs:

Arduino Mega Debugging LEDs
Arduino Mega Debugging LEDs

The excessive lead length on the 330 Ω resistors will eventually anchor scope probes syncing on / timing interesting program events.

Not that you have any, but they’re antique HP HDSP-4836 tuning indicators: RRYYGGYYRR. If you were being fussy, you might use 270 Ω resistors on the yellow LEDs to brighten them up.

A simple test program exercises the LEDs:

/*
  Debugging LED outputs for Mega board
  Ed Nisley - KE4ZNU
  Plug the board into the Digital Header pins 34-52 and GND 
*/

byte LowLED = 34;
byte HighLED = 52;
byte ThisLED = LowLED;

//-----
void setup() {
  pinMode(LED_BUILTIN,OUTPUT);
  
  for (byte p = LowLED; p <= HighLED; p+=2)
    pinMode(p, OUTPUT);

//  Serial.begin(9600);
}

// -----
void loop() {
  digitalWrite(LED_BUILTIN,HIGH);
  
  digitalWrite(ThisLED, HIGH);
  delay(100);
  digitalWrite(ThisLED, LOW);
 // delay(500);

  ThisLED = (ThisLED < HighLED) ? (ThisLED + 2) : LowLED;

//  Serial.println(ThisLED);

  digitalWrite(LED_BUILTIN,LOW);
}

Nothing fancy, but it ought to come in handy at some point.

2 thoughts on “Arduino MEGA Debugging LEDs

Spam comments get trashed, so don't bother. Comment moderation may cause a delay.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s