Requesting help on Leonardo Keyboard Emulation Functions

[code]
//Buttons

int BUTTON1 = 2;
int BUTTON2 = 4;
int BUTTON3 = 7;
int BUTTON4 = 8;
int BUTTON5 = 10;
int BUTTON6 = 11;


//LEDS
int LED1 = 3;
int LED2 = 5;
int LED3 = 6;
int LED4 = 9;


//States for LED and BUTTON (1)

int state1 = HIGH;      // the current state of the output pin
int reading1;           // the current reading from the input pin
int previous1 = LOW;    // the previous reading from the input pin

//States for LED and BUTTON (2)

int state2 = HIGH;      // the current state of the output pin
int reading2;           // the current reading from the input pin
int previous2 = LOW;    // the previous reading from the input pin

//States for LED and BUTTON (3)

int state3 = HIGH;      // the current state of the output pin
int reading3;           // the current reading from the input pin
int previous3 = LOW;    // the previous reading from the input pin

//States for LED and BUTTON (4)

int state4 = HIGH;      // the current state of the output pin
int reading4;           // the current reading from the input pin
int previous4 = LOW;    // the previous reading from the input pin


//State for BUTTON (5) Keyboard Begin



//State for BUTTON (6) Keyboard End



// the following variables are longs because the time, in ms,
// will quickly become a bigger number than can be stored in an int.
long time1 = 0;          // the last time the output pin was toggled
long time2 = 0;
long time3 = 0;
long time4 = 0;

long debounce1 = 200;   // the debounce time
long debounce2 = 200;
long debounce3 = 200;
long debounce4 = 200;


void setup()
{
  pinMode(BUTTON1, INPUT);
  pinMode(BUTTON2, INPUT);
  pinMode(BUTTON3, INPUT);
  pinMode(BUTTON4, INPUT);
  pinMode(BUTTON5, INPUT);
  pinMode(BUTTON6, INPUT);

  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);

}

void loop() {

  reading1 = digitalRead(BUTTON1);
  reading2 = digitalRead(BUTTON2);
  reading3 = digitalRead(BUTTON3);
  reading4 = digitalRead(BUTTON4);


  // if the input went from LOW to HIGH and waited long enough
  // to ignore any noise on the circuit, toggle the output pin and record
  // the time
  //Condition LED 1
  if (reading1 == HIGH && previous1 == LOW && millis() - time1 > debounce1) {
    if (state1 == HIGH)
      state1 = LOW;
    else
      state1 = HIGH;
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, LOW);
    digitalWrite(LED3, LOW);
    digitalWrite(LED4, LOW);
    time1 = millis();
  }

  //Condition LED 2
  if (reading2 == HIGH && previous2 == LOW && millis() - time2 > debounce2) {
    if (state2 == HIGH)
      state2 = LOW;
    else
      state2 = HIGH;
    digitalWrite(LED2, HIGH);
    digitalWrite(LED1, LOW);
    digitalWrite(LED3, LOW);
    digitalWrite(LED4, LOW);

    time2 = millis();
  }

  //Condition LED 3
  if (reading3 == HIGH && previous3 == LOW && millis() - time3 > debounce3) {
    if (state3 == HIGH)
      state3 = LOW;
    else
      state3 = HIGH;
    digitalWrite(LED3, HIGH);
    digitalWrite(LED1, LOW);
    digitalWrite(LED2, LOW);
    digitalWrite(LED4, LOW);

    time3 = millis();
  }

  //Condition LED 4
  if (reading4 == HIGH && previous4 == LOW && millis() - time4 > debounce4) {
    if (state4 == HIGH)
      state4 = LOW;
    else
      state4 = HIGH;
    digitalWrite(LED4, HIGH);
    digitalWrite(LED1, LOW);
    digitalWrite(LED2, LOW);
    digitalWrite(LED3, LOW);

    time4 = millis();
  }

  previous1 = reading1;
  previous2 = reading2;
  previous3 = reading3;
  previous4 = reading4;
}
Hello,

This is my first attempt at Arduino programming.  I have copied my code that I have completed so far, and note that it works as intended for the first phase of my project.  I have a Project Box with 6 momentary push buttons and 4 local LEDs for tally for the first four buttons.  The last two buttons have been reserved for use with Keyboard.begin and Keyboard.end.  I have spent the last 4 weeks learning code and using your forum in order to get the first phase completed.  The button 1, when pressed, will light the local tally led and a remote tally incandescent lamp on the remote camera.  When another of the 4 buttons is pressed, the tallies associated with the button will light, and the set of tallies that had been lit will extinguish. 
What I wish to do additionally, is to have button 1 emulate the action of the number 1 on the keyboard controls in order to do camera switching on the Wirecast program.  The same for the first 4 buttons, such that when the tally is lit, that camera video is switched through the Wirecast program as though the operator had pressed the "1" key on the computer keyboard.  
A young man by the name of Ken Addison has done this, and posted some of this information on New Tech Info, but he expanded his system to something like 64 x 64, which is much greater than my needs.  And, his  details are sketchy as to how he accomplished the task of emulation.  I searched the forums, and the internet.  I have found online books that purport to have information on the Leonardo, but I haven't found anything detailing the emulation portions.  I'm at a point of needing some assistance from someone to either point me to a good reference book or site, or to assist in the code writing to complete the phase 2 of my project.  
I have posted my code, and will attach a pdf of my schematic.  
I hope I am doing this posting right.  I read the posting information several times.  Any assistance would be gratefully appreciated; I don't know where to turn for help other than this forum.  Thanks

Leonardo.pdf (657 KB)

I can't begin to read what you want to do. What you want is NOT code, so why the hell is it in code tags?

I read the posting on How to Post a Topic, and I thought that I was doing what was asked of me. Please excuse me for the misunderstanding, and I will make another attempt to request help from the Forum.

My reading of your post says that you want to emulate a pushing of the "1" key when one of your buttons is pressed.

All that is needed to accomplish that is to include keyboard.h, call keyboard.begin() in setup() and call keyboard.print() when you want to send the keystroke. See the tutorial in the Learning section.

BTW, if you edit your first post and remove the code tags around the text that begins with "This is my first attempt ..." it should display properly.

Below is a simplified version of your code, tested working on a Leonardo.

#include "Keyboard.h"

int BUTTON1 = 2;                 // button push counter

int state1 = HIGH;      // the current state of the output pin
int reading1;           // the current reading from the input pin
int previous1 = LOW;    // the previous reading from the input pin

long time1 = 0;          // the last time the output pin was toggled


long debounce1 = 200;   // the debounce time


void setup() {
  // make the pushButton pin an input:
  pinMode(BUTTON1, INPUT);
  // initialize control over the keyboard:
  Keyboard.begin();
}

void loop() {
  // read the pushbutton:
  int reading1 = digitalRead(BUTTON1);

  // if the input went from LOW to HIGH and waited long enough
  // to ignore any noise on the circuit, toggle the output pin and record
  // the time
  //Condition LED 1
  if (reading1 == HIGH && previous1 == LOW && millis() - time1 > debounce1) {
    if (state1 == HIGH)
      state1 = LOW;
    else
      state1 = HIGH;
    Keyboard.print("1");    // emulate a press of the "1" key on the keyboard

    time1 = millis();
  }
  previous1 = reading1;

}