Noob questions about programming leonardo.

I look around the forum and i saw some posts talking about making a makey makey with an arduino leonardo.
The first guide i saw was this code. I think this is so sofisticated for me. The code is in this web http://hardware-hackingmx.com/2014/01/09/arduino-makey-makey/
Here is the protoboard I did: http://hardwarehackingmx.files.wordpress.com/2014/01/makeymakey.png

I did the protoboard but i dont understood anything (Im a totally noob at arduino). Then I saw this alter makey makey leonardo code for keyboard.press - Programming Questions - Arduino Forum.

That post has this code

#include <MovingAvarageFilter.h>

MovingAvarageFilter movingAvarageFilter1(20);
MovingAvarageFilter movingAvarageFilter2(20);

boolean check1 = false;
boolean check2 = false;
void setup() {

  Serial.begin(115200);     
}

void loop() {        

  float output1 = movingAvarageFilter1.process(analogRead(0));       
  float output2 = movingAvarageFilter2.process(analogRead(1));

  if (output1 < 200 ) {   // you can change this parameter to fine tune the sensitivity
    if (!check1){         
      Keyboard.print("d");         
      Serial.println(output1);           
      check1 = !check1;   
    }         
  }

  if (output1 >600) {     
    if (check1){               
      check1 = !check1;   
    }     
  }

  if (output2 < 590 ) {   // you can change this parameter to fine tune the sensitivity
    if (!check2){         
      Keyboard.print("s");         
      Serial.println(output2);           
      check2 = !check2;   
    }         
  }

  if (output2 >600) {     
    if (check2){               
      check2 = !check2;   
    }     
  }

}

First question, where is void setup ? I thought that every code has to have it. Is this code right ?
At the beginning of the void loop I can see that declares 2 outputs. I'd like to have 5 key press, so had i to declare 5 outputs and repeat the if bucle with every key ?. My last question about this project is how to setup the protoboard. In the first guide I had to put some resistors. I dunno how is exactly is working the last code. I think that it detects when you close the circuit with an analog input. Am I right ? in that case, i have to close the circuit with the 5v outut, 3.3V output or GND ?

I want to do another project with my leonardo but i had an issue. I want to key press a combination of keys at the same time. For example Start key + R. I dunno how to do it

Sorry for the post but i need help to understand the code, i'm getting afraid of try codes for myself because when i upload the BIG code, i play with it . When I finished I disconect the protoboard and the board detects keypress so i was not be able to re-upload new code because the port was busy (Sending ramdom key presses to my computer).
Thanks for the support, I'ld be very gratefull with any support.
PD: I know that I have to put 's' not "s".

Look more closely.
The setup() function (NOTE - not the 'void' setup') is here

void setup() {

  Serial.begin(115200);     
}

:sweat_smile: :sweat_smile: I read the code 20 times looking for it and I did not see it. I need a new glasses.

When i upload the code it gives me MovingAvarageFilter does not name a type and 'movingAvarageFilter2' was not declared in this scope

If you have the MovingAverageFilter library then either it is installed in the wrong place or you have not stopped and started the IDE since the installation.

Have you got the library and is it installed in the libraries folder in your sketches folder where it should be ?

I finally load the code at the board . it dont work. I conect the 5v to analog 1, when i disconect it it print 'sd'.

I change the code and put "s" to 's', its not working.

its not working.

Bullshit. The code is doing something. You appear not to have a clue what it is ACTUALLY doing.
You want it to do something. All that you know is that what the code is actually doing is not the same as what you want. That is NOT a valid definition of "not working".

So, get busy finding out what the code is ACTUALLY doing. Then, align your expectations to what the code actually does, or change the code to make it do something different.

No more whining "it doesn't work". That just is NOT tolerated here.