cd4014b example?

Hi,

I have a cd4014b and am trying to use the sample code on http://arduino.cc/en/Tutorial/ShiftIn
I realize these 2 chips are different. How do I change the example code to read the 8 inputs?
I searched the forums and it said to keep the latch high while reading from the clock. Is this all that needs to be done. Still not getting the correct results.

Thanks for the help!

The difference is that you have to raise the Clock pin after you raise the Parallel/Serial Control pin to latch the input data.

digitalWrite(latchPin, HIGH);  // Switch to Parallel Input
digitalWrite(clockPin, HIGH);  // latch the parallel data
digitalWrite(clockPin, LOW);
digitalWrite(latchPin, LOW);  // Switch back to serial operation
byte switches = shiftIn(dataPin, clockPin, bitOrder);

Thanks, I picked up a 4021 today. I will test the 4014 when my project is done (tight deadline) and post example code for other people in the same boat.

I've met the same problem
The above code is a little bit wrong. It doesn't read the first bit correctly.
Here is the working code for those who needs it:

digitalWrite(B_latchPin, HIGH);  // Switch to Parallel Input
digitalWrite(B_clockPin, HIGH);  // latch the parallel data
digitalWrite(B_latchPin, LOW);  // Switch back to serial operation
switches = shiftIn(B_dataPin, B_clockPin, MSBFIRST); //read pins state
digitalWrite(B_clockPin, LOW); //close clock.