Well ... just looking at it quickly you aren't testing your analogvalue
This
void loop() {
sensorValue = analogRead(sensorPin); // reads the value from IR transmitter/receiver
int k=0;
for (int t=0;t<10;t++){
for (int j=2;j<9;j++){
digitalWrite (j, uparray[k]);
if (sensorValue > threshold) {
k=k+1;
//k=k+1;
}
delay(2000);}
Serial.println(sensorValue);
}
Should be more like this (I'm wrinting this free hand so you will have to check it)
int currentValue = 0;
void loop() {
sensorValue = analogRead(sensorPin); // reads the value from IR transmitter/receiver
boolean changeLED = false;
if (sensorValue == 1) { // 1 might not be the right value you will have to see what sensorValue is when the beam is broken
changeLED = true;
currentValue = currentValue + 1; // Increase the number we want to display * would be a good place to put a max value like
if (currentValue >9){
currentValue = 9;
}
}
if (changeLED == true){
for (int j=2;j<9;j++){
digitalWrite (j, ((uparray[j][currentValue] & 1) == 1) ? HIGH : LOW); // Set all the pins either on or off based on the number we want to display
// ie if our currentValue = 0 then
// uparray[2][0] = 1 which needs to be high
}
}
}