shift out LED / Shift in button inputs

I’m working on a pinball machine, that needs to have targets light up as triggers are switched. I’m using the (shifter.h) library for the light outputs:

http://bildr.org/2011/08/74hc595-breakout-arduino/

but I also need to use a shift register to gather a large number of button inputs. I currently don’t see any documentation on how shifter.h can call incoming data like that.

I’m wondering if I can get input data using shifter.h, and also, if I can recall that data from the same chain of shift registers I’m using to output data to the LEDs?

Here’s my code. The light turns on when I score 100. But the button doesn’t work now that I have it hooked up to the shift register. I need to change that code to talk to it:

#include "pitches.h"
#include <LiquidCrystal.h>
#include <Shifter.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

#define SER_Pin 7 //SER_IN
#define RCLK_Pin 6 //L_CLOCK
#define SRCLK_Pin 8 //CLOCK

#define NUM_REGISTERS 2 //how many registers are in the chain
Shifter shifter(SER_Pin, RCLK_Pin, SRCLK_Pin, NUM_REGISTERS); 

  boolean lastReadButton0;
  boolean lastReadButton1;
  boolean lastReadButton2;
  boolean lastReadButton3;
  boolean lastReadButton4;
  boolean lastReadButton5;


  unsigned int score = 0;
  int ballnumber = 0;
  int a = 100;
  int b = 500;
  int c = 1000;


////NEW GAME////
int newGameMelody[] = 
{
  NOTE_DS3, NOTE_D2, NOTE_D1, NOTE_DS3, NOTE_D2, NOTE_D1, NOTE_G4, NOTE_E4, NOTE_DS4,
};
int noteDurations5[] = 
{
  8, 8, 8, 8, 8, 8, 4, 4, 2, 2, 
};
///////////////////////

////Ball lost melody////
int ballLostMelody[] = 
{
  NOTE_DS3, NOTE_D3, NOTE_B2, NOTE_GS2, NOTE_B1
};
int noteDurations0[] = 
{
  8, 8, 4, 2, 2,
};
///////////////////////

////SCORE A////
int scoreAMelody[] = 
{
 NOTE_E4, NOTE_E5, NOTE_E6,
};
int noteDurations1[] = 
{
 8, 16, 16,
};
///////////////////////

////SCORE B////
int scoreBMelody[] = 
{
 NOTE_E7, NOTE_E6, NOTE_E5, NOTE_E4, NOTE_E5, NOTE_E6,
};
int noteDurations2[] = 
{
 16, 16, 16, 8, 16, 16,
};
///////////////////////

////SCORE C////
int scoreCMelody[] = 
{
 NOTE_E7, NOTE_E6, NOTE_E5,  NOTE_E7, NOTE_E6, NOTE_E5, NOTE_E7, NOTE_E6, NOTE_E5,
};
int noteDurations3[] = 
{
 16, 16, 16, 16, 16, 16, 8, 8, 8,
};
///////////////////////

// SETUP===========================================
void setup() {

//input pins for scoring triggers
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
  pinMode(A3, INPUT);
  pinMode(A4, INPUT);

// set up the LCD:
  lcd.begin(16, 2);
  lcd.clear();

}

//LOOP==============================================
void loop() {

////LCD DISPLAY: SCORE / GAME OVER////

  if (ballnumber < 1)
  { 
    lcd.setCursor(0, 0);
    lcd.print("GAME OVER         ");
  }
  else
  {
  lcd.setCursor(0, 0);
  lcd.print("SCORE:    BALL:");
  lcd.print(ballnumber);
  }
//LCD: NUMERIC SCORE
 
  lcd.setCursor(0, 1);
  lcd.print(score);


///NEW GAME////////////////////////////////////////////////
   boolean readButton5 = digitalRead(A4);
 
  if (readButton5 == LOW and lastReadButton5 == HIGH)
  {
      score = 0;
      ballnumber = 3;
      lcd.setCursor(0,1);
      lcd.print("               ");

      shifter.setAll(HIGH);
      shifter.write();


////NEW GAME MELODY////=============================
  for (int thisNote = 0; thisNote < 8; thisNote++) {

    int noteDuration5 = 1000 / noteDurations5[thisNote];
    tone(8, newGameMelody[thisNote], noteDuration5);

    int pauseBetweenNotes = noteDuration5 * 1.0;
    delay(pauseBetweenNotes);
 
    noTone(8);

      shifter.setAll(LOW);
      shifter.write();
}////================================================
       
  }
 lastReadButton5 = readButton5;

///LOST BALL//////////////////////////////////////
   boolean readButton0 = digitalRead(A0);
 
  if (readButton0 == LOW and lastReadButton0 == HIGH)
  {
      ballnumber = ballnumber - 1;
      
////BALL LOST MELODY////=============================
  for (int thisNote = 0; thisNote < 8; thisNote++) {

    int noteDuration0 = 1000 / noteDurations0[thisNote];
    tone(8, ballLostMelody[thisNote], noteDuration0);

    int pauseBetweenNotes = noteDuration0 * 1.10;
    delay(pauseBetweenNotes);

    noTone(8);
}////================================================
  
  }
  lastReadButton0 = readButton0;

 
///SCORE a 100 PTS//////////////////////////////////////////////
   boolean readButton2 = digitalRead(A1);
 
  if (readButton2 == LOW and lastReadButton2 == HIGH)
  {
      score = score + a;
     shifter.setPin(8, HIGH); 
     shifter.write();

      ////SCORE A MELODY////=============================
  for (int thisNote = 0; thisNote < 8; thisNote++) {

    int noteDuration1 = 1000 / noteDurations1[thisNote];
    tone(8, scoreAMelody[thisNote], noteDuration1);

    int pauseBetweenNotes = noteDuration1 * 1.0;
    delay(pauseBetweenNotes);

    noTone(8);
}////================================================

  }
  lastReadButton2 = readButton2;

///SCORE B 500 PTS/////////////////////////////////////////////////
   boolean readButton3 = digitalRead(A2);
 
  if (readButton3 == LOW and lastReadButton3 == HIGH)
  {
      score = score + b;

////SCORE B MELODY////=============================
  for (int thisNote = 0; thisNote < 8; thisNote++) {

    int noteDuration2 = 1000 / noteDurations2[thisNote];
    tone(8, scoreBMelody[thisNote], noteDuration2);

    int pauseBetweenNotes = noteDuration2 * 1.0;
    delay(pauseBetweenNotes);

    noTone(8);
}////================================================

  }
  lastReadButton3 = readButton3;

///SCORE C 1000 PTS////////////////////////////////////////////////
   boolean readButton4 = digitalRead(A3);
 
  if (readButton4 == LOW and lastReadButton4 == HIGH)
  {
      score = score + c;


////SCORE C MELODY////=============================
  for (int thisNote = 0; thisNote < 8; thisNote++) {

    int noteDuration3 = 1000 / noteDurations3[thisNote];
    tone(8, scoreCMelody[thisNote], noteDuration3);

    int pauseBetweenNotes = noteDuration3 * 1.0;
    delay(pauseBetweenNotes);
 
    noTone(8);
}////================================================
      
  }
  lastReadButton4 = readButton4;

}

and an image of my set up. I need to get the buttons bellow to light up the lights above. Can I do that on the same register chain? If not, how do I set that up so they dont override each other?

No, the 74HC595 shift register is a Serial In, Parallel Out shift register. It is not bi-directional.

You need the opposite: a Parallel In, Serial Out, such as the 74HC165, as Nick Gammon told you in your other topic.