 
 void loop()
 {
+  //get button values
   //buttons take so long to analogRead(), no need to debounce
   int currentBank = readButton(INPUT_BANK);
   int currentUp = readButton(INPUT_UP);
   int currentDown = readButton(INPUT_DOWN);
   
-  //switch bank on button down
+  //switch bank when button is DOWN
   if(currentBank && (!lastBank))
   {
     bankNum++;
-    bankNum = bankNum % 10;
+    bankNum = bankNum % 10; //wrap
     setDisplay(bankNum);
   }
   lastBank = currentBank;
   
-  
+  //perform action based on button press states
   if(currentUp && !currentDown)
   {
     


void sendBurst(BurstPair pair, uint8_t carrier)
{
  //ON
  for(int i = 0; i < pair.on; i++)
  {
    //bitWrite(PORTB, OUTPUT_IR_A, 1);
    PORTB |= B00110000; //HIGH
    delayMicroseconds(carrier);
    //bitWrite(PORTB, OUTPUT_IR_A, 0);
    PORTB &= B11001111; //LOW
    delayMicroseconds(carrier);
  }
  
  //OFF
  //bitWrite(PORTB, OUTPUT_IR_A, 0);
  PORTB &= B11001111; //LOW
  delayMicroseconds(carrier * 2 * pair.off);
}


void setDisplay(int n) //0-9
{
  //turn everything off FIRST (one resistor for many LEDS)
  for(int i = OUTPUT_DISPLAY; i < OUTPUT_DISPLAY + 10; i++)
  {
    digitalWrite(i, LOW);
  }
  
  if((n >= 0) && (n <= 9))
  {
    digitalWrite(OUTPUT_DISPLAY + n, HIGH);
  }
}

int readButton(int pin)
{
  int val = analogRead(pin);
  if(val >= 512)
  {
    return 1;
  }
  return 0;
}

#include "Codes.h"


#define OUTPUT_DISPLAY 2 //occupies pins [x, x+9]
#define INPUT_BANK A2
#define INPUT_UP A1
#define INPUT_DOWN A0
#define CODE_DELAY 6

//running vars
int bankNum = 0; //current code bank (bar graph indicator)
int lastBank = 0; //old button value (to detect DOWN press)
int currentCode = 0; //current code to send (incremented every loop())

void setup()
{
  //make all the pins outputs
  for(int i = 2; i < 14; i++)
  {
