where does these ones come from ?

2 is OK

Confirm pins 1, 4, 13, 14, 16 15 are grounded on the shift register.

EDIT:
Sorry 15 not 16!

LarryD:
2 is OK

Confirm pins 1, 4, 13, 14, 16 15 are grounded on the shift register.

EDIT:
Sorry 15 not 16!

ok i confirm

now this is what i am getting just 0 and nothing is happening when i click the push buttons

results monitor.jpg

firashelou:
actully yes the comments but it's not me that made it, simply from this website is the mistake !!

That's an assumption.
Assumptions are dangerous.
You got it from this website (meaning Arduino.cc ?) but that doesn't mean it is flawless.
Can you read the sketch (code) and understand what's happening there ?
Can you confirm this with the description in the comments ?
The problems of your ghost ones are very unlikely to be caused by the sketch.

and about the multiple check i don't know how to do it in this case !! and the time of debouncing must be pretty fast so ?

The multiple check is not important until you solve your actual problem, being unforeseen ones.
Debouncing means allowing some time to pass so the (mechanical) buttonstate is stabilized.
To allow for just a few micro seconds to pass, is like not doing any debouncing at all.
Use the technique from "blink without delay" to set a fitting and non blocking debounce time.

By the way:
Why do you NEED to do this ?
Is it some school project ?
If so, the goal is to learn how stuff works (dûhh).
You will not learn by telling you: "Do this and that and then it will work" (like LarryD just did and make you change the wiring of those pins, do you understand what that does ?).

MAS3:

firashelou:
actully yes the comments but it's not me that made it, simply from this website is the mistake !!

That's an assumption.
Assumptions are dangerous.
You got it from this website (meaning Arduino.cc ?) but that doesn't mean it is flawless.
Can you read the sketch (code) and understand what's happening there ?
Can you confirm this with the description in the comments ?
The problems of your ghost ones are very unlikely to be caused by the sketch.

and about the multiple check i don't know how to do it in this case !! and the time of debouncing must be pretty fast so ?

The multiple check is not important until you solve your actual problem, being unforeseen ones.
Debouncing means allowing some time to pass so the (mechanical) buttonstate is stabilized.
To allow for just a few micro seconds to pass, is like not doing any debouncing at all.
Use the technique from "blink without delay" to set a fitting and non blocking debounce time.

By the way:
Why do you NEED to do this ?
Is it some school project ?
If so, the goal is to learn how stuff works (dûhh).
You will not learn by telling you: "Do this and that and then it will work" (like LarryD just did and make you change the wiring of those pins, do you understand what that does ?).

about the comments well, i am new to registers so reading comments and checking these codes was weird because i found something weird but i was unable to understand the codes because some comments was let's say awkward

it's a personal big project

about what larry said, well i tried it before but nothing has been solved, so i did tried it again when Larry said because i thought maybe there was something missing but seems not

i guess my last choice is to get another arduino and make a serial communication between the 2, but that's not an economical way because then i must double the power given to arduino and make it 2 set of batteries !! :S

int latchPin = 8;
int dataPin = 9; EDIT: found in #12
int clockPin = 7;

I redrew your schematic, please compare it with yours.
If the above pins are as you say it does not agree with the schematic.

LarryD:
int latchPin = 8;
int dataPin = 9; EDIT: found in #12
int clockPin = 7;

I redrew your schematic, please compare it with yours.
If the above pins are as you say it does not agree with the schematic.

ok your schematic is exactly like mine but you are taking the pins 2,4 and 5 from arduino but me 7, 8 and 9

int latchPin = 8;
int dataPin = 9; From thread reply #12
int clockPin = 7;

Are using the code in thread reply #12?

Are you wired up as in thread reply #2?

LarryD:
int latchPin = 8;
int dataPin = 9; From thread #12
int clockPin = 7;

Are using the code in thread #12?

Are you wired up as in thread #2?

this is the tutorial i was doing : http://www.arduino.cc/en/Tutorial/ShiftIn
and now i am using the example 1 : hello world
i am wired same as you schematic except the latch, datapin and clockPin
and these are the codes :

//define where your pins are
int latchPin = 8;
int dataPin = 9;
int clockPin = 7;

//Define variables to hold the data 
//for shift register.
//starting with a non-zero numbers can help
//troubleshoot
byte switchVar1 = 72;  //01001000

void setup() {
  //start serial
  Serial.begin(9600);

  //define pin modes
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT); 
  pinMode(dataPin, INPUT);

}

void loop() {

  //Pulse the latch pin:
  //set it to 1 to collect parallel data
  digitalWrite(latchPin,1);
  //set it to 1 to collect parallel data, wait
  delayMicroseconds(20);
  //set it to 0 to transmit data serially  
  digitalWrite(latchPin,0);

  //while the shift register is in serial mode
  //collect each shift register into a byte
  //the register attached to the chip comes in first 
  switchVar1 = shiftIn(dataPin, clockPin);

  //Print out the results.
  //leading 0's at the top of the byte 
  //(7, 6, 5, etc) will be dropped before 
  //the first pin that has a high input
  //reading  
  Serial.println(switchVar1, BIN);

//white space
Serial.println("-------------------");
//delay so all these print satements can keep up. 
delay(500);

}

//------------------------------------------------end main loop

////// ----------------------------------------shiftIn function
///// just needs the location of the data pin and the clock pin
///// it returns a byte with each bit in the byte corresponding
///// to a pin on the shift register. leftBit 7 = Pin 7 / Bit 0= Pin 0

byte shiftIn(int myDataPin, int myClockPin) { 
  int i;
  int temp = 0;
  int pinState;
  byte myDataIn = 0;

  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, INPUT);
//we will be holding the clock pin high 8 times (0,..,7) at the
//end of each time through the for loop

//at the begining of each loop when we set the clock low, it will
//be doing the necessary low to high drop to cause the shift
//register's DataPin to change state based on the value
//of the next bit in its serial information flow.
//The register transmits the information about the pins from pin 7 to pin 0
//so that is why our function counts down
  for (i=7; i>=0; i--)
  {
    digitalWrite(myClockPin, 0);
    delayMicroseconds(2);
    temp = digitalRead(myDataPin);
    if (temp) {
      pinState = 1;
      //set the bit to 0 no matter what
      myDataIn = myDataIn | (1 << i);
    }
    else {
      //turn it off -- only necessary for debuging
     //print statement since myDataIn starts as 0
      pinState = 0;
    }

    //Debuging print statements
    //Serial.print(pinState);
    //Serial.print("     ");
    //Serial.println (dataIn, BIN);

    digitalWrite(myClockPin, 1);

  }
  //debuging print statements whitespace
  //Serial.println();
  //Serial.println(myDataIn, BIN);
  return myDataIn;
}

Are you wired up as in your reply #2?

this is the tutorial i was doing : http://www.arduino.cc/en/Tutorial/ShiftIn
and now i am using the example 1 : hello world
i am wired same as you schematic except the latch, datapin and clockPin
and these are the codes :

OK

When you press and hold the button pressed, what do you see on the serial monitor?

LarryD:
When you press and hold the button pressed, what do you see on the serial monitor?

nothing the same numbers still go and first bit at the left is always 1
when i touch the resisters with my finger i see this :

0

0

0

i removed all the grounded pin on the register
i got the results in the picture : without pressing
and when i press and hold down, i got the results in picture : when pressing down and hold

without pressing.jpg

when pressed down and hold.jpg

i changed the delayMicroseconds(2) to delayMicroseconds(0.2) and i got these results back again :

results.jpg

You should have the unused inputs to the shit register at a logic LOW or HIGH level, not floating.
A low can be 0Volts and a HIGH can be a resistor (10K) to +5 volts.
Note:
You should place a decoupling capacitor from pin 16 to pin 8 (.1uF)

When you press a switch, confirm with a volt meter that you get 0V to +5V level change on its register input.

LarryD:
You should have the unused inputs to the shit register at a logic LOW or HIGH level, not floating.
A low can be 0Volts and a HIGH can be a resistor (10K) to +5 volts.
Note:
You should place a decoupling capacitor from pin 16 to pin 8 (.1uF)

When you press a switch, confirm with a volt meter that you get 0V to +5V level change on its register input.

so you suggest i put 1 capacitor connected to the pins 8 to 16 on the shift register , but i didn't get why, those pins are unused !!?
ok then how do i connect that capacitor can you please show me on the schematic ?

This is for decoupling.
Any transient voltages are absorbed by this device.

When you press a switch, confirm with a volt meter that you get 0V to +5V level change on its register input.

LarryD:
This is for decoupling.
Any transient voltages are absorbed by this device.

When you press a switch, confirm with a volt meter that you get 0V to +5V level change on its register input.

ok i tried it, i put a ceramic capacitor 0.1 and still here are the results i don't know why the 1 on the left is always there !!
sometimes i get 0 and when i move the circuit i get back to 100000 .... same results as before

results monitor.jpg

When you press a switch, confirm with a volt meter that you get 0V to +5V level change on its register input.

Check all 3 switches.

LarryD:
When you press a switch, confirm with a volt meter that you get 0V to +5V level change on its register input.

Check all 3 switches.

ok i don't confirm that !! :frowning:

Then do the same test again at the switches.
Do you see a HIGH at all at any connected pin of the switches ?
Do you see a LOW change to HIGH when you press the switch ?

Did you see this remark (i mentioned it before) ?

firashelou:

  //Print out the results.

//leading 0's at the top of the byte
 //(7, 6, 5, etc) will be dropped before
 //the first pin that has a high input
 //reading

Doesn't that say there will be no zero's printed before a one is detected ?
That again means there will be different lengths in your serial screen, i guess.
And of course the first digit will always be a one.