Shifting Does Not Change Values

I am trying to do a project where I shift a value up to a certain point. However, even though the values are being shifted in the output, the program is not recognizing their change in value. Can anyone provide any insight.

if(movepowers[7] <= 224 && shiftT > 0){
Serial.println(movepowers[7];
shiftval = shiftT;
movepowers[7] << shiftval;
}

shodai:
...., the program is not recognizing their change in value. Can anyone provide any insight.

And we are supposed to understand the issue here with just that snippet and comment!!!!

This won't compile, so the code was never tested.

Serial.println(movepowers[7];
movepowers[7] << shiftval;

This is not an assignment.

My apologies. I was trying to keep things short by just retyping a small segment. Here is my current full code.

//DECALRE VARIABLES 
//LEFT BOARD
int clockPinA = 13;
int latchPinA = 12;
int dataPinA =11;

//RIGHT BOARD
int clockPinB = 10;
int latchPinB = 9;
int dataPinB = 8;

int start;
byte moveGrounds[8] = {127,191,223,239,247,251,253,254}; //set up powers with inital values
int movePowers[8] = {255,255,255,0,0,0,8,28}; //set up grounds with initial values
int shiftT = 0;

int sensorPin = 0;
int sensorValue;

int shiftVal =0;
int shift =0;

void setup() {
  // put your setup code here, to run once:
  pinMode(latchPinA, OUTPUT); //sets pins to output - makes them light up
  pinMode(clockPinA, OUTPUT);//pins on d2l
  pinMode(dataPinA, OUTPUT); 
  
  pinMode(latchPinB, OUTPUT);
  pinMode(clockPinB, OUTPUT);
  pinMode(dataPinB, OUTPUT); 
  Serial.begin(9600);
}
//if it were me, I would have these draw things in a function and then call the function and update the value for the paddle and the ball withing the array.
//create a function to return a value
//int myFunctio()
//myFunctio()
//return 

//function for shift values

int Shift (int shiftVal)
{
for (int j = 0; j < 100; j ++)
    {
//Serial.println(shiftVal);
      
    //draw bricks
    for(int i =0;i<6; i++)
    {
    //turing lights on with values of the arrays
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, movePowers[i]);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, moveGrounds[i]);
    digitalWrite(latchPinB, HIGH);
    
    delay(1); //makes reset possible

    //reset values
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, B00000000);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, B11111111);
    digitalWrite(latchPinB, HIGH);    
    }

    for(int i =0;i<1; i++)
    {
    //turing lights on with values of the arrays
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, movePowers[6]);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, moveGrounds[6]);
    digitalWrite(latchPinB, HIGH);
    
    delay(1); //makes reset possible

    //reset values
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, B00000000);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, B11111111);
    digitalWrite(latchPinB, HIGH);    
    }

if(sensorValue >= 240 &&sensorValue<= 600)
  {
    for(int i =0;i<1; i++)
    {
    //turing lights on with values of the arrays
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, movePowers[7]<<shiftVal);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, moveGrounds[7]);
    digitalWrite(latchPinB, HIGH);
    
    delay(1); //makes reset possible

    //reset values
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, B00000000);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, B11111111);
    digitalWrite(latchPinB, HIGH);    
    }
}
    else if(sensorValue >= 600 &&sensorValue<= 1022)
      {
           for(int i =0;i<1; i++)
    {
    //turing lights on with values of the arrays
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, movePowers[7]>>shiftVal);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, moveGrounds[7]);
    digitalWrite(latchPinB, HIGH);
    
    delay(1); //makes reset possible

    //reset values
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, B00000000);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, B11111111);
    digitalWrite(latchPinB, HIGH);    
    } 
      }

//    else if(sensorValue >= 500 &&sensorValue<= 800)
//      {
//           for(int i =0;i<1; i++)
//    {
//    //turing lights on with values of the arrays
//    digitalWrite(latchPinA, LOW);
//    shiftOut(dataPinA, clockPinA, LSBFIRST, movePowers[7]);
//    digitalWrite(latchPinA, HIGH);
//    
//    digitalWrite(latchPinB, LOW);
//    shiftOut(dataPinB, clockPinB, LSBFIRST, moveGrounds[7]);
//    digitalWrite(latchPinB, HIGH);
//    
//    delay(1); //makes reset possible
//
//    //reset values
//    digitalWrite(latchPinA, LOW);
//    shiftOut(dataPinA, clockPinA, LSBFIRST, B00000000);
//    digitalWrite(latchPinA, HIGH);
//    
//    digitalWrite(latchPinB, LOW);
//    shiftOut(dataPinB, clockPinB, LSBFIRST, B11111111);
//    digitalWrite(latchPinB, HIGH);    
//    } 
//      }

}

return shiftVal;
}

void loop() {
  shift = Shift(shiftVal);// i dont think this is 
  sensorValue = analogRead(sensorPin);
  //Serial.println(sensorValue);

  if(sensorValue >= 240 &&sensorValue<= 500)
  {
 shiftT= shiftT+1;
    if(movePowers[7]<=224&&shiftT>0)
    {
        Serial.println(movePowers[7]);
      shiftVal = shiftT;
    }
  }
  else if(sensorValue >= 700 &&sensorValue<= 1022)
  {
   shiftT= shiftT+1;
    if(movePowers[7]>=7&&shiftT>0)
    {
    shiftVal = shiftT;
    }
  }
else if(sensorValue< 500&&sensorValue > 700)
  {
//    if(shiftT>0)
//    {
//    shiftT= shiftT-1;
//    }
    shiftVal=shiftVal; 
  }
}

Please get rid of all the confusing, commented out portions of the code, and repost after testing the modified code.

Use ^T to properly format your code.

If there is a line like that identified in reply #3, fix that before reposting.

//DECALRE VARIABLES 
//LEFT BOARD
int clockPinA = 13;
int latchPinA = 12;
int dataPinA =11;

//RIGHT BOARD
int clockPinB = 10;
int latchPinB = 9;
int dataPinB = 8;

int start;
byte moveGrounds[8] = {127,191,223,239,247,251,253,254}; //set up powers with inital values
int movePowers[8] = {255,255,255,0,0,0,8,28}; //set up grounds with initial values
int shiftT = 0;

int sensorPin = 0;
int sensorValue;

int shiftVal =0;
int shift =0;

void setup() {
  // put your setup code here, to run once:
  pinMode(latchPinA, OUTPUT); //sets pins to output - makes them light up
  pinMode(clockPinA, OUTPUT);//pins on d2l
  pinMode(dataPinA, OUTPUT); 
  
  pinMode(latchPinB, OUTPUT);
  pinMode(clockPinB, OUTPUT);
  pinMode(dataPinB, OUTPUT); 
  Serial.begin(9600);
}


int Shift (int shiftVal)
{
for (int j = 0; j < 100; j ++)
    {
//Serial.println(shiftVal);
      
    //draw bricks
    for(int i =0;i<6; i++)
    {
    //turing lights on with values of the arrays
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, movePowers[i]);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, moveGrounds[i]);
    digitalWrite(latchPinB, HIGH);
    
    delay(1); //makes reset possible

    //reset values
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, B00000000);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, B11111111);
    digitalWrite(latchPinB, HIGH);    
    }

    for(int i =0;i<1; i++)
    {
    //turing lights on with values of the arrays
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, movePowers[6]);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, moveGrounds[6]);
    digitalWrite(latchPinB, HIGH);
    
    delay(1); //makes reset possible

    //reset values
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, B00000000);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, B11111111);
    digitalWrite(latchPinB, HIGH);    
    }

if(sensorValue >= 240 &&sensorValue<= 600)
  {
    for(int i =0;i<1; i++)
    {
    //turing lights on with values of the arrays
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, movePowers[7]<<shiftVal);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, moveGrounds[7]);
    digitalWrite(latchPinB, HIGH);
    
    delay(1); //makes reset possible

    //reset values
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, B00000000);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, B11111111);
    digitalWrite(latchPinB, HIGH);    
    }
}
    else if(sensorValue >= 600 &&sensorValue<= 1022)
      {
           for(int i =0;i<1; i++)
    {
    //turing lights on with values of the arrays
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, movePowers[7]>>shiftVal);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, moveGrounds[7]);
    digitalWrite(latchPinB, HIGH);
    
    delay(1); //makes reset possible

    //reset values
    digitalWrite(latchPinA, LOW);
    shiftOut(dataPinA, clockPinA, LSBFIRST, B00000000);
    digitalWrite(latchPinA, HIGH);
    
    digitalWrite(latchPinB, LOW);
    shiftOut(dataPinB, clockPinB, LSBFIRST, B11111111);
    digitalWrite(latchPinB, HIGH);    
    } 
      }

}

return shiftVal;
}

void loop() {
  shift = Shift(shiftVal);// i dont think this is 
  sensorValue = analogRead(sensorPin);
  //Serial.println(sensorValue);

  if(sensorValue >= 240 &&sensorValue<= 500)
  {
 shiftT= shiftT+1;
    if(movePowers[7]<=224&&shiftT>0)
    {
        Serial.println(movePowers[7]);
      shiftVal = shiftT;
    }
  }
  else if(sensorValue >= 700 &&sensorValue<= 1022)
  {
   shiftT= shiftT+1;
    if(movePowers[7]>=7&&shiftT>0)
    {
    shiftVal = shiftT;
    }
  }
else if(sensorValue< 500&&sensorValue > 700)
  {
    shiftVal=shiftVal; 
  }
}

You forgot to describe what the most recently posted code does, and whether that matches your expectations.

I believe what the original poster is asking for is answered by arduino_new in post #3.

Bitwise operators do not assign the value. You must store the result in a variable with = just like + or -.

i = 14; // Bit pattern 00001110
j = i >> 1; // here we have the bit pattern shifted by 1 thus we get 00000111 = 7 which is 14/2

So does this mean that every time I shift, I should include a second variable that is keeping track of each shift?

Try:

movepowers[7] <<= shiftval;

shodai:
So does this mean that every time I shift, I should include a second variable that is keeping track of each shift?

No, you can do the thing like this:

 int iBit = 1;
iBit = iBit << 1;