I think this is the right place to ask this. Also I've had a search of the internet and these forums but I don't seem to have come up with anything that helps which suggests that either it can't be done (which I think is very unlikely) or I've made a really simple mistake that I just can't seem to spot.

I've basically followed the tutorial on the arduino site for shift in http://www.arduino.cc/en/Tutorial/ShiftIn and using the code for what is pressed for 8 buttons http://arduino.cc/en/Tutorial/ShftIn12 (the only change I've made is because I'm using different pins)

When I upload the sketch to the arduino and open the serial monitor all I get is full 0s as the input from the 595 except occasionally it will read all 1s then randomly drop different bytes until it reaches all 0s again

I've taken some photos of how I actually put it together and linked them below (you may notice that the buttons appear to be connected to gnd and the shift register but its actually +5v)

Hard to tell from the photos but have you put a signal to all the ic inputs, especially the reset? If they are not connected to 5v or gnd you can get strange effects from the floating inputs.

Just realized you are trying to use the 595 as an input device. The example uses a different chip. The 595 is for output only. You should get into the habit of reading the datasheets for the devices you use as these will spell out the capabilities.

Yes the 74hc595 you can use only as a serial to parallel expander. For inputs its good to use the I2c-Bus called also TwoWireBus and the PCF8574. I think you will find some application and hints in the Internet. On this IC you can use the pins as well as inputs and outputs.kitte

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

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

//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(switchVar, BIN); // or Serial.println(switchVar, DEC);

//white spaceSerial.println("-------------------");//delay so all these print satements can keep up. delay(1000);