A working sketch will have one setup() and one loop(), so you would want to combine the contents of these functions. The remainder of the sketches you can pretty well combine by just pasting that stuff together into a new sketch. For example:
combining:
void setup() {
// initialize serial communication:
Serial.begin(9600);
}
and
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
you might come up with
void setup() {
// initialize serial communication:
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}